Re: [PATCH] printk: Userspace format enumeration support

Chris Down
2021-02-05T23:20:08Z

Oh, and one more I just spotted and will fix in v2 after other feedback is in:

Chris Down writes:
>+static void store_printk_fmt_sec(const struct module *mod, const char **start,
>+ const char **end)
>+{
>+ struct printk_fmt_sec *ps = NULL;
>+ const char **fptr = NULL;
>+ size_t size = 0;
>+
>+ ps = kmalloc(sizeof(struct printk_fmt_sec), GFP_KERNEL);
>+ if (!ps)
>+ return;
>+
>+ ps->module = mod;
>+ ps->start = start;
>+ ps->end = end;
>+
>+ for (fptr = ps->start; fptr < ps->end; fptr++)
>+ size += strlen(*fptr) + 1;

This still works, but is out of date and doesn't account for the module and
comma, so results in one more unnecessary round trip doing seq_buf_alloc.