summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.com>2019-04-17 07:53:49 -0400
committerPetr Mladek <pmladek@suse.com>2019-04-26 10:21:03 -0400
commit635720ac75a51092b456bed517ff170047883252 (patch)
tree9f458a2c4488835f3935301a87d976c04d4f2532
parent3e5903eb9cff707301712498aed9e34b3e2ee883 (diff)
vsprintf: Avoid confusion between invalid address and value
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>
-rw-r--r--Documentation/core-api/printk-formats.rst1
-rw-r--r--lib/vsprintf.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index b2cac8d76b66..75d2bbe9813f 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -64,6 +64,7 @@ might be printed instead of the unreachable information::
64 64
65 (null) data on plain NULL address 65 (null) data on plain NULL address
66 (efault) data on invalid address 66 (efault) data on invalid address
67 (einval) invalid data on a valid address
67 68
68Plain Pointers 69Plain Pointers
69-------------- 70--------------
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b989f1e8f35b..4e5666035b74 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1511,7 +1511,7 @@ char *ip_addr_string(char *buf, char *end, const void *ptr,
1511 case AF_INET6: 1511 case AF_INET6:
1512 return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt); 1512 return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt);
1513 default: 1513 default:
1514 return string_nocheck(buf, end, "(invalid address)", spec); 1514 return string_nocheck(buf, end, "(einval)", spec);
1515 }} 1515 }}
1516 } 1516 }
1517 1517