lkml.org 
[lkml]   [2018]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid pointers
On Thu, 15 Mar 2018 17:03:09 +0900
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> wrote:

> On (03/15/18 16:58), Sergey Senozhatsky wrote:
> > On (03/14/18 15:09), Petr Mladek wrote:
> > [..]
> > > +static const char *check_pointer_access(const void *ptr)
> > > +{
> > > + unsigned char byte;
> > > +
> > > + if (!ptr)
> > > + return "(null)";
> > > +
> > > + if (probe_kernel_read(&byte, ptr, 1))
> > ^^^^^
> > Why one byte? sizeof(ptr)?
>
> I think there is a shorter version - probe_kernel_address(),
> which, seems, was designed for this particular kind of stuff.
>
> void *p;
>
> if (probe_kernel_address(ptr, p))
> ....
>

Agreed.

-- Steve

\
 
 \ /
  Last update: 2018-03-15 18:02    [W:0.056 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site