Re: [V4 PATCH ftrace/core] ftrace: Introduce saved_cmdlines_size file

From: Steven Rostedt
Date: Wed Jun 04 2014 - 12:24:00 EST



Almost there ;-)

On Wed, 04 Jun 2014 16:18:48 +0900
Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@xxxxxxxxxxx> wrote:


> +
> +static int allocate_cmdlines_buffer(unsigned int val,
> + struct saved_cmdlines_buffer *s)
> +{
> + s->map_cmdline_to_pid = kmalloc(val * sizeof(unsigned), GFP_KERNEL);

s/sizeof(unsigned)/sizeof(*s->map_cmdline_to_pid)/

For the same reason as the memset.

Other than that, I think the rest looks good.

-- Steve

> + if (!s->map_cmdline_to_pid)
> + return -ENOMEM;
> +
> + s->saved_cmdlines = kmalloc(val * TASK_COMM_LEN, GFP_KERNEL);
> + if (!s->saved_cmdlines) {
> + kfree(s->map_cmdline_to_pid);
> + return -ENOMEM;
> + }
> +
> + s->cmdline_idx = 0;
> + s->cmdline_num = val;
> + memset(&s->map_pid_to_cmdline, NO_CMDLINE_MAP,
> + sizeof(s->map_pid_to_cmdline));
> + memset(s->map_cmdline_to_pid, NO_CMDLINE_MAP,
> + val * sizeof(*s->map_cmdline_to_pid));
> +
> + return 0;
> +}
> +
--
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/