From 21c2a0434775a09dcde4b7a49722b3b23efd071d Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Thu, 21 May 2026 13:56:34 +0200 Subject: [PATCH] cpumf/pai: Remove unnecessary const parameter definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With glibc 2.43 const-ness is preserved for standard library functions and a compiler warning will be issued if this is violated. pai parse_cpulist() receives user input via the parm function parameter. The parameter is defined as 'const char *' and used as input value for strchr(). The target pointer (cp) is defined as mutable 'char *' leading to violation of const correctness and this compiler warning: pai.c: In function ‘parse_cpulist’: pai.c:907:20: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 907 | cp = strchr(parm, ':'); Since the user input is coming from optarg 'non-const char *', it is unnecessary to have the function parameters carrying this data defined as const. Remove the unnecessary const definition in the function call chain to fix the described issue. Signed-off-by: Thomas Richter Suggested-by: Jan Hoeppner Suggested-by: Juergen Christ Signed-off-by: Jan Höppner --- cpumf/pai.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpumf/pai.c b/cpumf/pai.c index 34ae4a4c..1b8f22d1 100644 --- a/cpumf/pai.c +++ b/cpumf/pai.c @@ -894,7 +894,7 @@ static int parse_event_attr(char *cp) } /* Parse CPU list and event specifications */ -static void parse_cpulist(int enr, const char *parm) +static void parse_cpulist(int enr, char *parm) { unsigned int evt_attr = 0; cpu_set_t cmdlist, result; @@ -948,14 +948,14 @@ static const struct util_prg prg = { } }; -static void record_cpus_crypto(const char *cp) +static void record_cpus_crypto(char *cp) { if (!libcpumf_have_pai_crypto()) errx(EXIT_FAILURE, "No support for PAI crypto counters"); parse_cpulist(S390_EVT_PAI_CRYPTO, cp); } -static void record_cpus_nnpa(const char *cp) +static void record_cpus_nnpa(char *cp) { if (!libcpumf_have_pai_nnpa()) errx(EXIT_FAILURE, "No support for PAI nnpa counters");