lkml.org 
[lkml]   [2011]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 05/16] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query()
    On Tue, Dec 20, 2011 at 08:08:41AM +0000, Bart Van Assche wrote:
    > On Mon, Dec 19, 2011 at 10:12 PM, Jason Baron <jbaron@redhat.com> wrote:
    > >
    > > From: Jim Cromie <jim.cromie@gmail.com>
    > >
    > > Replace strcpy with strlcpy, and add define for the size constant.
    > >
    > > [jbaron@redhat.com: Use DDEBUG_STRING_SIZE for overflow check]
    > > Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    > > Signed-off-by: Jason Baron <jbaron@redhat.com>
    > > ---
    > >  lib/dynamic_debug.c |    8 +++++---
    > >  1 files changed, 5 insertions(+), 3 deletions(-)
    > >
    > > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
    > > index 8c88b89..6fc8622 100644
    > > --- a/lib/dynamic_debug.c
    > > +++ b/lib/dynamic_debug.c
    > > @@ -525,14 +525,16 @@ EXPORT_SYMBOL(__dynamic_netdev_dbg);
    > >
    > >  #endif
    > >
    > > -static __initdata char ddebug_setup_string[1024];
    > > +#define DDEBUG_STRING_SIZE 1024
    > > +static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE];
    > > +
    > >  static __init int ddebug_setup_query(char *str)
    > >  {
    > > -       if (strlen(str) >= 1024) {
    > > +       if (strlen(str) >= DDEBUG_STRING_SIZE) {
    > >                pr_warn("ddebug boot param string too large\n");
    > >                return 0;
    > >        }
    > > -       strcpy(ddebug_setup_string, str);
    > > +       strlcpy(ddebug_setup_string, str, DDEBUG_STRING_SIZE);
    > >        return 1;
    > >  }
    >
    > Sorry, but it's not clear to me why it make sense to introduce the
    > DDEBUG_STRING_SIZE macro instead of using ARRAY_SIZE().
    >
    > Bart.

    Greg,

    The change suggested here by Bart isn't a functional change. If you
    think it warrants a re-post, let me know, but I am fine with it as-is.

    Thanks,

    -Jason
    --
    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: 2011-12-21 22:33    [W:0.022 / U:29.592 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site