Re: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid pointers
From: Sergey Senozhatsky
Date: Thu Mar 15 2018 - 04:03:25 EST
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))
....
-ss