Re: [GIT PULL] tracing: Fix misuse of strncpy to copy boot params

From: Frederic Weisbecker
Date: Thu Oct 15 2009 - 08:35:11 EST


On Thu, Oct 15, 2009 at 10:01:13AM +0800, Li Zefan wrote:
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 4506826..621d81e 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -131,7 +131,7 @@ static char *default_bootup_tracer;
> >
> > static int __init set_ftrace(char *str)
> > {
> > - strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
> > + strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
>
> Actually using strncpy() here is fine.
>
> See how the str buf is used:
>
> int register_tracer(struct tracer *type)
> {
> ...
> if (strncmp(default_bootup_tracer, type->name, MAX_TRACER_SIZE))
> ...
> }



Yeah. I can remove the change for this buffer and send
another pull request.

Thanks.


> > default_bootup_tracer = bootup_tracer_buf;
> > /* We are using ftrace early, expand it */
> > ring_buffer_expanded = 1;

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