]> git.hungrycats.org Git - linux/commitdiff
[PATCH] make printk more robust with "null" pointers
authorAndrew Morton <akpm@osdl.org>
Wed, 22 Oct 2003 01:22:28 +0000 (18:22 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 22 Oct 2003 01:22:28 +0000 (18:22 -0700)
Expand printk's traditional handling of null pointers so that anything in the
first page is considered a null pointer.

This gives us better behaviour when someone (acpi..) accidentally prints a
string which is embedded in a struct, the pointer to which is null.

lib/vsprintf.c

index 0803ac5438e122e659bfec61bdf0f1fc0ab2dd90..5ae1c3765f4c9af9c1c3e8ecc767db8973636737 100644 (file)
@@ -348,7 +348,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 
                        case 's':
                                s = va_arg(args, char *);
-                               if (!s)
+                               if ((unsigned long)s < PAGE_SIZE)
                                        s = "<NULL>";
 
                                len = strnlen(s, precision);