From patchwork Mon Oct 24 11:31:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571429wru; Mon, 24 Oct 2022 10:33:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LGMsbCNAo3Fymre+nrfGVKHDV83FBDzOSvM+UGH4HknEKo+gIKEQy2SAdGQUvqqGQofQT X-Received: by 2002:a62:7b0f:0:b0:56b:e472:9e81 with SMTP id w15-20020a627b0f000000b0056be4729e81mr4721662pfc.13.1666632789854; Mon, 24 Oct 2022 10:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632789; cv=none; d=google.com; s=arc-20160816; b=i6z41ueyW5qOqqLmlOo1aKXiGVNzsBtfNRVK5WAFZj2PDTW3Z5F+DkYtz8d8RA8Unw DgJsiq20qdnnOqJGpne3YT3HUMNu3cfQSp4kTUnoyssLNH5oA+x6GuNy0rTQSyQJTRkZ YwOdCSTPzsgv3tfhZPBGeV4807i2FTnhAMqvaqrMXlHKYMjMV3HWdxDN3P4i+mEhQxCL sZ8fFw51BBXWJmCvGA6dLA7yxfANrSobxG0TfFNIqA0K/ymvh4BT2CRoo50T5pgd29WZ cs5vUPS1co0/ayjNZAzAxZ+Kq9i0aNUo1xJ4ZSgOo96VJuPNTVho4N04SYIsLmGJslj1 6aoQ== 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=gSykExTMx3nTCTPi7Tjh+QZ8i7+60yauknQWARfhyoc=; b=eDHO486V5yEx5p73K98WyokhYsIkN5Fm+QDKyxLuQAdOPov3Wg0VQ0Q/5cuEqrcdi1 sivLjM3Zd04RIBvylGCkXrHFeg+XSaJ9Xd7y3avK3TudVHJ2fSqFMIcYakQ8mtTEj/FP Txk5ubbUUXuKi0uYmeblNFjFIAl/hZTclL0Hi51x2bY4/QR1njDtLpSoRxksRDLUeq95 8JpG+rsAW4HTFaHOCGPwZdfJeahXqjsW8DsNq0ZVM7n8+P3o6XlfRKTxgfTEWiNeMjtV Cv2LSi0crwDq6NjJwva029ZfUg6RDNhdEFZo1mzrUC9CRDMVhZYHmZs4j4+X3lsmwRLu V4Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="My30US/X"; 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 ng10-20020a17090b1a8a00b00205d798ce68si636781pjb.139.2022.10.24.10.32.56; Mon, 24 Oct 2022 10:33:09 -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="My30US/X"; 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 S233143AbiJXRbn (ORCPT + 99 others); Mon, 24 Oct 2022 13:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbiJXRbV (ORCPT ); Mon, 24 Oct 2022 13:31:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09102248F7; Mon, 24 Oct 2022 09:06:45 -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 ams.source.kernel.org (Postfix) with ESMTPS id 46449B8169C; Mon, 24 Oct 2022 12:28:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 703E5C433C1; Mon, 24 Oct 2022 12:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614534; bh=/OXXMxHwFAPpWYWH3Twq50RGB1+01cfTvXGSwWG1oCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=My30US/Xa8JGI5vpKuIJo2oGAKC2WENgYAKVcrcl0yTgxxCZ3jk2xqoRyWJaDhxo3 7PBSup/1lXGy3qimMUOd/1IlN777hGzBLD/iZJ96BnoheHERolwRil21oErWuCu80a P6V46tUcSCUwzVBXyUhhFoNEx04CRdI7khhgzMpU= 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.10 298/390] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024113035.709028609@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747591144038834344?= X-GMAIL-MSGID: =?utf-8?q?1747591144038834344?= 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 3e2a8166377f..22509b5fab74 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; @@ -163,7 +163,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;