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.

Signed-off-by: Richard Weinberger <rich...@nod.at>
---
 lib/vsprintf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index da39c60..092d5a7 100644
--- 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 ||
+           (unsigned long)s < PAGE_SIZE)
                s = "(null)";
 
        len = strnlen(s, spec.precision);
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to