]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
um: drivers: call kernel_strrchr() explicitly in cow_user.c
authorMichael Bommarito <michael.bommarito@gmail.com>
Wed, 8 Apr 2026 07:01:02 +0000 (03:01 -0400)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 8 Apr 2026 07:25:22 +0000 (09:25 +0200)
Building ARCH=um on glibc >= 2.43 fails:

  arch/um/drivers/cow_user.c: error: implicit declaration of
  function 'strrchr' [-Wimplicit-function-declaration]

glibc 2.43's C23 const-preserving strrchr() macro does not survive
UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile.
Call kernel_strrchr() directly in cow_user.c so the source no longer
depends on the -D rewrite.

Fixes: 2c51a4bc0233 ("um: fix strrchr() problems")
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-6
Assisted-by: Codex:gpt-5-4
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Link: https://patch.msgid.link/20260408070102.2325572-1-michael.bommarito@gmail.com
[remove unnecessary 'extern']
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/drivers/cow_user.c

index 29b46581ddd137c6418d8b8d6ec7a6febe4080c1..dc1d1bcd85ec240d17e4838c7153d0c636f4d97b 100644 (file)
 #include "cow.h"
 #include "cow_sys.h"
 
+/*
+ * arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel
+ * name directly to avoid glibc >= 2.43's C23 strrchr macro.
+ */
+char *kernel_strrchr(const char *, int);
+
 #define PATH_LEN_V1 256
 
 /* unsigned time_t works until year 2106 */
@@ -153,7 +159,7 @@ static int absolutize(char *to, int size, char *from)
                           errno);
                return -1;
        }
-       slash = strrchr(from, '/');
+       slash = kernel_strrchr(from, '/');
        if (slash != NULL) {
                *slash = '\0';
                if (chdir(from)) {