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

From: Li Zefan
Date: Wed Oct 14 2009 - 22:03:31 EST


> 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))
...
}

> 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/