lkml.org 
[lkml]   [2018]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 09/18] qlogic/qed: change strncpy+truncation to strlcpy
    Date
    Generated by scripts/coccinelle/misc/strncpy_truncation.cocci

    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    ---

    Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the
    first patch of the serie) for the motivation behind this patch

    drivers/net/ethernet/qlogic/qed/qed_debug.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
    index a14e48489029..4fe0a72230e8 100644
    --- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
    +++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
    @@ -6212,8 +6212,7 @@ static void qed_read_str_from_buf(void *buf, u32 *offset, u32 size, char *dest)
    {
    const char *source_str = &((const char *)buf)[*offset];

    - strncpy(dest, source_str, size);
    - dest[size - 1] = '\0';
    + strlcpy(dest, source_str, size);
    *offset += size;
    }

    --
    2.17.1
    \
     
     \ /
      Last update: 2018-07-15 22:06    [W:4.040 / U:0.456 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site