lkml.org 
[lkml]   [2021]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk: Userspace format enumeration support
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.

\
 
 \ /
  Last update: 2021-02-06 00:20    [W:0.108 / U:1.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site