[lkml]   [2022]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] m68k: string: Make char intermediate in strcmp() signed
Since char became unsigned, strcmp() always returns a positive number.

"res" is used to store a byte difference, so it should be signed.

Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")
Signed-off-by: Geert Uytterhoeven <>
See "Re: [PATCH v9] kallsyms: Add self-test facility"

I'm wondering how many surprises like this are still hidden...
arch/m68k/include/asm/string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index f759d944c4499404..b8f4ae19e8f6ee2c 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -42,7 +42,7 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
static inline int strcmp(const char *cs, const char *ct)
- char res;
+ signed char res;

asm ("\n"
"1: move.b (%0)+,%2\n" /* get *cs */
 \ /
  Last update: 2022-12-15 14:31    [W:0.066 / U:4.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site