lkml.org 
[lkml]   [2003]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [TRIVIAL] kstrdup
    Rusty Trivial Russell wrote:
    > +char *kstrdup(const char *s, int gfp)
    > +{
    > + char *buf = kmalloc(strlen(s)+1, gfp);
    > + if (buf)
    > + strcpy(buf, s);
    > + return buf;
    > +}



    You should save the strlen result to a temp var, and then s/strcpy/memcpy/

    Jeff



    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:34    [W:0.023 / U:65.924 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site