From nobody Tue Apr 14 12:26:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27CE6C4332F for ; Thu, 15 Dec 2022 13:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiLONaT (ORCPT ); Thu, 15 Dec 2022 08:30:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiLONaP (ORCPT ); Thu, 15 Dec 2022 08:30:15 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB782124B for ; Thu, 15 Dec 2022 05:30:13 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed10:2d49:7a8c:85ed:ab2b]) by michel.telenet-ops.be with bizsmtp id wdW92800w4DzhY606dW9S1; Thu, 15 Dec 2022 14:30:10 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1p5oJM-000GrD-Fy; Thu, 15 Dec 2022 14:30:08 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1p5oJL-001mxT-SL; Thu, 15 Dec 2022 14:30:07 +0100 From: Geert Uytterhoeven To: "Jason A . Donenfeld" Cc: linux-m68k@lists.linux-m68k.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] m68k: string: Make char intermediate in strcmp() signed Date: Thu, 15 Dec 2022 14:30:04 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Jason A. Donenfeld --- See "Re: [PATCH v9] kallsyms: Add self-test facility" https://lore.kernel.org/r/CAMuHMdWM6+pC3yUqy+hHRrAf1BCz2sz1KQv2zxS+Wz-639X-= aA@mail.gmail.com 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) #define __HAVE_ARCH_STRCMP static inline int strcmp(const char *cs, const char *ct) { - char res; + signed char res; =20 asm ("\n" "1: move.b (%0)+,%2\n" /* get *cs */ --=20 2.25.1