aboutsummaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2021-02-25 17:46:39 +0100
committerPetr Mladek <pmladek@suse.com>2021-04-07 13:20:59 +0200
commita48849e2358ecf1a347a03b33dc27b9b2f25f8fd (patch)
treef47ee70b3fb98b2b99b5ac451a4d480bbdbbb132 /lib/vsprintf.c
parentea35d8677811296730e762a2888cda3f01d13a89 (diff)
printk: clarify the documentation for plain pointer printing
We have several modifiers for plain pointers (%p, %px and %pK) and now also the no_hash_pointers boot parameter. The documentation should help to choose which variant to use. Importantly, we should discourage %px in favor of %p (with the new boot parameter when debugging), and stress that %pK should be only used for procfs and similar files, not dmesg buffer. This patch clarifies the documentation in that regard. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20210225164639.27212-1-vbabka@suse.cz
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 4a14889ccb35..5ec8ad238d03 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2189,7 +2189,9 @@ early_param("no_hash_pointers", no_hash_pointers_enable);
* Implements a "recursive vsnprintf".
* Do not use this feature without some mechanism to verify the
* correctness of the format string and va_list arguments.
- * - 'K' For a kernel pointer that should be hidden from unprivileged users
+ * - 'K' For a kernel pointer that should be hidden from unprivileged users.
+ * Use only for procfs, sysfs and similar files, not printk(); please
+ * read the documentation (path below) first.
* - 'NF' For a netdev_features_t
* - 'h[CDN]' For a variable-length buffer, it prints it as a hex string with
* a certain separator (' ' by default):
@@ -2228,7 +2230,8 @@ early_param("no_hash_pointers", no_hash_pointers_enable);
* Without an option prints the full name of the node
* f full name
* P node name, including a possible unit address
- * - 'x' For printing the address. Equivalent to "%lx".
+ * - 'x' For printing the address unmodified. Equivalent to "%lx".
+ * Please read the documentation (path below) before using!
* - '[ku]s' For a BPF/tracing related format specifier, e.g. used out of
* bpf_trace_printk() where [ku] prefix specifies either kernel (k)
* or user (u) memory to probe, and: