lkml.org 
[lkml]   [2018]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 11/11] vsprintf: Avoid confusion between invalid address and value
Date
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)".

Signed-off-by: Petr Mladek <pmladek@suse.com>
---
Documentation/core-api/printk-formats.rst | 1 +
lib/vsprintf.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index 3b25adde1ec7..e1a0ef2179f0 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -56,6 +56,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

Also a WARN_ON() is triggered when non-NULL address is not reachable
and panic_on_warn is disabled.
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 46e3e7c71229..79ee96afd538 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1473,8 +1473,7 @@ char *ip_addr_string(char *buf, char *end, void *ptr, struct printf_spec spec,
case AF_INET6:
return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt);
default:
- return valid_string(buf, end, "(invalid address)",
- spec);
+ return valid_string(buf, end, "(einval)", spec);
}}
}

--
2.13.6
\
 
 \ /
  Last update: 2018-04-25 13:14    [W:0.140 / U:12.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site