lkml.org 
[lkml]   [2009]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] tracing: use strlcpy instead of strncpy
    On 05/18/2009 01:35 PM, Lai Jiangshan wrote:
    > strlcpy() will add '\0' for the copied string.
    >
    > [Impact] cleanup
    ...
    > --- a/kernel/trace/trace_branch.c
    > +++ b/kernel/trace/trace_branch.c
    > @@ -67,10 +67,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
    > p--;
    > p++;
    >
    > - strncpy(entry->func, f->func, TRACE_FUNC_SIZE);
    > - strncpy(entry->file, p, TRACE_FILE_SIZE);
    > - entry->func[TRACE_FUNC_SIZE] = 0;
    > - entry->file[TRACE_FILE_SIZE] = 0;
    > + strlcpy(entry->func, f->func, TRACE_FUNC_SIZE);
    > + strlcpy(entry->file, p, TRACE_FILE_SIZE);

    Hmm, this is not the same. +1 is missing here.


    \
     
     \ /
      Last update: 2009-05-18 22:59    [W:2.259 / U:0.676 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site