From 662289eeb3dd00b79d36b5f8f0f834d7df306bdc Mon Sep 17 00:00:00 2001 From: Tashfin Shakeer Rhythm Date: Thu, 12 Feb 2026 02:44:21 +0600 Subject: [PATCH] modpost: Do not discard const qualifier in match() match() receives 'sym' as RO string. But strstr() does not return non-const char, which here implicitly casts away the const qualifier. Declare 'here' as 'const char *' to fix the following warning by Clang: ../scripts/mod/modpost.c:870:10: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 870 | char *here = strstr(sym, bare); | ^ ~~~~~~~~~~~~~~~~~ Change-Id: I3df77d2cd975ff965517b9319ea8013cc6ce2561 Signed-off-by: Tashfin Shakeer Rhythm --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 32d2c4170d42..49911e2b8509 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -804,7 +804,7 @@ static int match(const char *sym, const char * const pat[]) /* "*foo*" */ if (*p == '*' && *endp == '*') { char *bare = NOFAIL(strndup(p + 1, strlen(p) - 2)); - char *here = strstr(sym, bare); + const char *here = strstr(sym, bare); free(bare); if (here != NULL)