On Fri 2019-11-22 12:26:08, glider@xxxxxxxxxx wrote: > Insert KMSAN hooks that check for potential memory errors and/or make > necessary bookkeeping changes: > - allocate/split/deallocate metadata pages in > alloc_pages()/split_page()/free_page(); > - clear page shadow and origins in clear_page(), copy_user_highpage(); > - copy page metadata in copy_highpage(), wp_page_copy(); > - handle vmap()/vunmap()/iounmap(); > - handle task creation and deletion; > - initialize result of vscnprintf() in vprintk_store(); > - call softirq entry/exit hooks in kernel/softirq.c; > - check/initialize memory sent to/read from USB, I2C, and network > > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index ca65327a6de8..c9ef7fb0906f 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1915,6 +1915,12 @@ int vprintk_store(int facility, int level, > * prefix which might be passed-in as a parameter. > */ > text_len = vscnprintf(text, sizeof(textbuf), fmt, args); > + /* > + * If any of vscnprintf() arguments is uninitialized, KMSAN will report > + * one or more errors and also probably mark text_len as uninitialized. > + * Initialize |text_len| to prevent the errors from spreading further. > + */ > + text_len = KMSAN_INIT_VALUE(text_len); > > /* mark and strip a trailing newline */ > if (text_len && text[text_len-1] == '\n') { Acked-by: Petr Mladek <pmladek@xxxxxxxx> # for printk.c Best Regards, Petr