Skip to content

Commit 6655360

Browse files
andy-shevakpm00
authored andcommitted
lib/vsprintf: declare no_hash_pointers in sprintf.h
Sparse is not happy to see non-static variable without declaration: lib/vsprintf.c:61:6: warning: symbol 'no_hash_pointers' was not declared. Should it be static? Declare respective variable in the sprintf.h. With this, add a comment to discourage its use if no real need. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Marco Elver <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt (Google) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 39ced19 commit 6655360

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

include/linux/sprintf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ __printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list
2020
__scanf(2, 3) int sscanf(const char *, const char *, ...);
2121
__scanf(2, 0) int vsscanf(const char *, const char *, va_list);
2222

23+
/* These are for specific cases, do not use without real need */
24+
extern bool no_hash_pointers;
2325
int no_hash_pointers_enable(char *str);
2426

2527
#endif /* _LINUX_KERNEL_SPRINTF_H */

lib/test_printf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ KSTM_MODULE_GLOBALS();
4242
static char *test_buffer __initdata;
4343
static char *alloced_buffer __initdata;
4444

45-
extern bool no_hash_pointers;
46-
4745
static int __printf(4, 0) __init
4846
do_test(int bufsize, const char *expect, int elen,
4947
const char *fmt, va_list ap)

mm/kfence/report.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/printk.h>
1414
#include <linux/sched/debug.h>
1515
#include <linux/seq_file.h>
16+
#include <linux/sprintf.h>
1617
#include <linux/stacktrace.h>
1718
#include <linux/string.h>
1819
#include <trace/events/error_report.h>
@@ -26,8 +27,6 @@
2627
#define ARCH_FUNC_PREFIX ""
2728
#endif
2829

29-
extern bool no_hash_pointers;
30-
3130
/* Helper function to either print to a seq_file or to console. */
3231
__printf(2, 3)
3332
static void seq_con_printf(struct seq_file *seq, const char *fmt, ...)

0 commit comments

Comments
 (0)