[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1521119224.10722.664.camel@linux.intel.com>
Date: Thu, 15 Mar 2018 15:07:04 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Petr Mladek <pmladek@...e.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"Tobin C . Harding" <me@...in.cc>, Joe Perches <joe@...ches.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.cz>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid
pointers
On Thu, 2018-03-15 at 16:58 +0900, Sergey Senozhatsky wrote:
> On (03/14/18 15:09), Petr Mladek wrote:
>
> > char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> > struct printf_spec spec)
> > {
> > + static const char data_access_fmt[] =
> > "RrhbMmIiEUVNadCDgGO";
> > const int default_width = 2 * sizeof(void *);
> > + const char *err_msg = NULL;
> > +
> > + /* Prevent silent crash when this is called under
> > logbuf_lock. */
> > + if (*fmt && strchr(data_access_fmt, *fmt) != NULL)
> > + err_msg = check_pointer_access(ptr);
>
> Agree with Rasmus, I think switch() is easier.
>
One more to the same.
Though need to add that we also have to append / update some comment to
keep these lists synchronized (in Documentation, around pointer() and
here)
--
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
Powered by blists - more mailing lists