Re: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid pointers
From: Steven Rostedt
Date: Thu Mar 15 2018 - 13:07:23 EST
On Thu, 15 Mar 2018 16:07:54 +0100
Petr Mladek <pmladek@xxxxxxxx> wrote:
> Good point. The following should do the job:
>
> static const char *check_pointer_access(const void *ptr)
> {
> char c;
>
> if (!ptr)
> return "(null)";
>
> if ((unsigned long)ptr < TASK_SIZE || probe_kernel_address(ptr, c))
Please don't.
-- Steve
> return "(efault)";
>
> return 0;
> }