lkml.org 
[lkml]   [2015]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] Fix printk() on ERR_PTR()
Date
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 <richard@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


\
 
 \ /
  Last update: 2015-05-10 22:21    [W:0.070 / U:0.340 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site