From patchwork Sat Oct 22 07:27:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106380wrr; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MbnwLruThpgslo7LWOIwv9fOhS8aMNksC/s7MhHkEudQXXwHfLyq9mPPb57XYAFu1be4h X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr19181175ejc.516.1666427862511; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427862; cv=none; d=google.com; s=arc-20160816; b=x7s2AJWFyiwkQ9NmU4Xf43fJFAt+8cdHAiUFmUxgK5aZ8xLg6FMGvAo9FaasyikH2o D5zaQigDxmD5HmWP73YItckwQ9eZcWuxGmbEpqRlcObQyrSsTs8Bz5ajI6wCIdvD2m1P yj0J7DNWn4V50XLhQa6w2jpIpLBhN+gSBdUxzGwtS737YX29NuX1msHl0HvO0HbI5shb Ly+U2qk6jTsRRzRWgLxCJ5LJ4XhgXS4OJayZkekXfBpED19AqdjSxlXAezgqHe2Ths2l c04XfCaAt/6kfLS8DIgsZAdD1R/duUhh/fF12lOLueoZbUy8dGQ5sTHsu/fW6Nig7DVX vKhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f80RdvYLhvTAVR3P3Bw9zKIbAfB5GF0D/Soc9uxZKkk=; b=0FAsX4N50/4pa8fkIhCwX+vhLzqscmu5PnXUbRKG+yzQL1D40Ddkdnh827frsubnbP s6lBTWIbsdA/bn6FSiosGjFQWkVINNTIh7pLOP4duyp3aFftslrEMr1AzEgrT50JVoLH EHqfQbsUdhdbaHq6dniW6hSuk8P5qEsLFTHlGZ2uD74UBm0/GxnqeTsFb8z3sDoR5F3r WMgH95PVNZOCjc5Ne0E19Nj5nQeoERzp0+Npk0Z1UgNV6i5Ut1O0J4wb5ugvf71mq63P 2bvRzAUwAAow41BVv8T6ClwxSo8WrRT4BZiMqIWRxahYJVku4bDYT1LR8ercm+IUxuGe Yeug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dGu4EJwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b007918f58458bsi11989716ejc.441.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dGu4EJwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbiJVIcS (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234026AbiJVI3O (ORCPT ); Sat, 22 Oct 2022 04:29:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044602E22A9; Sat, 22 Oct 2022 01:01:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA22160ADD; Sat, 22 Oct 2022 07:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C576EC433C1; Sat, 22 Oct 2022 07:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425583; bh=sm/LDBBuPWty4rPPEEqovbTw/jWuPeNCGNYMtE2bPkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGu4EJwt1fryvkeOa/wlOSwWhFLqJeu53nKg5tG9lvCj6w1EWH9rdtojEct1oN/qC atPDJ75O7wkR9mSVpM/Hicjzx5uzAv38i3QYToBmM2UOJXYDcfSokc6nWLob0BgVQm mHejx1tXFd65cnItFHP9H69C97kRMEv21oevnPLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev, kernel test robot , Kees Cook , Sasha Levin Subject: [PATCH 5.19 548/717] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Sat, 22 Oct 2022 09:27:07 +0200 Message-Id: <20221022072522.604305739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376262103002724?= X-GMAIL-MSGID: =?utf-8?q?1747376262103002724?= From: Kees Cook [ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ] Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error: arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp' if (!memcmp(prom_init, prom_init + mem, 32)) ^~~~~~ include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t); Cc: Hauke Mehrtens Cc: "Rafał Miłecki" Cc: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: llvm@lists.linux.dev Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202209080652.sz2d68e5-lkp@intel.com Signed-off-by: Kees Cook Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/bcm47xx/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c index 0a63721d0fbf..5a33d6b48d77 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -86,7 +86,7 @@ static __init void prom_init_mem(void) pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -159,7 +159,7 @@ void __init bcm47xx_prom_highmem_init(void) off = EXTVBASE + __pa(off); for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) { - if (!memcmp(prom_init, (void *)(off + extmem), 16)) + if (!memcmp((void *)prom_init, (void *)(off + extmem), 16)) break; } extmem -= lowmem;