[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150511162039.05a035367d1895738ca85155@linux-foundation.org>
Date: Mon, 11 May 2015 16:20:39 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Richard Weinberger <richard@....at>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] Fix printk() on ERR_PTR()
On Sun, 10 May 2015 21:42:15 +0200 Richard Weinberger <richard@....at> wrote:
> vbin_printf() checks whether the provided pointer is larger
> than -PAGE_SIZE such that it does not explode on ERR_PTR() pointers.
> printk() does not.
>
> Let's add this check also to the printk() code such that
> trace_printk() and printk() are consistent again.
>
> ..
>
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -511,7 +511,8 @@ char *string(char *buf, char *end, const char *s, struct printf_spec spec)
> {
> int len, i;
>
> - if ((unsigned long)s < PAGE_SIZE)
> + if ((unsigned long)s > (unsigned long)-PAGE_SIZE ||
hm, PAGE_SIZE has type ulong, so is the cast needed?
> + (unsigned long)s < PAGE_SIZE)
This would be a place for
if (!within(PAGE_SIZE, (unsigned long)s, -PAGE_SIZE))
s = "(null)";
I'm counting at least five implementations of within(), not all the same.
Maybe. Both the lower and upper bounds will sometimes want inclusive
semantics, sometimes exclusive.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists