OSDN Git Service

vsprintf: Avoid confusion between invalid address and value
authorPetr Mladek <pmladek@suse.com>
Wed, 17 Apr 2019 11:53:49 +0000 (13:53 +0200)
committerPetr Mladek <pmladek@suse.com>
Fri, 26 Apr 2019 14:21:03 +0000 (16:21 +0200)
We are able to detect invalid values handled by %p[iI] printk specifier.
The current error message is "invalid address". It might cause confusion
against "(efault)" reported by the generic valid_pointer_address() check.

Let's unify the style and use the more appropriate error code description
"(einval)".

Link: http://lkml.kernel.org/r/20190417115350.20479-10-pmladek@suse.com
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Tobin C . Harding" <me@tobin.cc>
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Documentation/core-api/printk-formats.rst
lib/vsprintf.c

index b2cac8d..75d2bbe 100644 (file)
@@ -64,6 +64,7 @@ might be printed instead of the unreachable information::
 
        (null)   data on plain NULL address
        (efault) data on invalid address
+       (einval) invalid data on a valid address
 
 Plain Pointers
 --------------
index b989f1e..4e56660 100644 (file)
@@ -1511,7 +1511,7 @@ char *ip_addr_string(char *buf, char *end, const void *ptr,
                case AF_INET6:
                        return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt);
                default:
-                       return string_nocheck(buf, end, "(invalid address)", spec);
+                       return string_nocheck(buf, end, "(einval)", spec);
                }}
        }