[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1520263504.10722.399.camel@linux.intel.com>
Date: Mon, 05 Mar 2018 17:25:04 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Rasmus Villemoes <linux@...musvillemoes.dk>,
Petr Mladek <pmladek@...e.com>
Cc: "Tobin C . Harding" <me@...in.cc>, Joe Perches <joe@...ches.com>,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.cz>
Subject: Re: [PATCH] vsprintf: Make "null" pointer dereference more robust
On Mon, 2018-03-05 at 16:16 +0100, Rasmus Villemoes wrote:
> On 2 March 2018 at 13:53, Petr Mladek <pmladek@...e.com> wrote:
> > - if (!ptr && *fmt != 'K' && *fmt != 'x') {
> > + if ((unsigned long)ptr < PAGE_SIZE && *fmt != 'K' && *fmt !=
> > 'x') {
>
> ISTM that accidentally passing an ERR_PTR would be just as likely as
> passing a NULL pointer (or some small offset from one), so if we do
> this, shouldn't the test also cover IS_ERR values?
We (will) have such check in two places, perhaps a helper
static bool is_pointer_valid(void *ptr)
{
return !IS_ERR(ptr) && (unsigned long)ptr >= PAGE_SIZE;
}
?
--
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
Powered by blists - more mailing lists