lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251104045558.1644671-1-hehuiwen@kylinos.cn>
Date: Tue,  4 Nov 2025 12:55:58 +0800
From: Huiwen He <hehuiwen@...inos.cn>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	linux-kernel@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org,
	Huiwen He <hehuiwen@...inos.cn>
Subject: [PATCH] tracing/hist: make err_text array fully const

The err_text array contains string literals that are never modified.
Previously it was declared as:

    static const char *err_text[]

which makes the strings themselves const but allows the pointers
in the array to be changed.

Change it to:

    static const char * const err_text[]

This prevents accidental modification of the array pointers,
fixes checkpatch warnings, and allows the compiler to place the
entire array in the read-only data section (.rodata).

Signed-off-by: Huiwen He <hehuiwen@...inos.cn>
---
 kernel/trace/trace_events_hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 1d536219b624..3be35ebdaa62 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -80,7 +80,7 @@ enum { ERRORS };
 #undef C
 #define C(a, b)		b
 
-static const char *err_text[] = { ERRORS };
+static const char * const err_text[] = { ERRORS };
 
 struct hist_field;
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ