From 8bcb3ba1dec5749a7f1eed570cb69a20c2e4bd41 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 21 Oct 2003 18:22:28 -0700 Subject: [PATCH] [PATCH] make printk more robust with "null" pointers 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 0803ac5438e12..5ae1c3765f4c9 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -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 = ""; len = strnlen(s, precision); -- 2.53.0