From patchwork Mon Oct 24 11:31:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430533wru; Mon, 24 Oct 2022 05:41:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X5QaYtkF4fKIx0RDlw5OpKX5Q1CofOeKo7j9SzPKMLsvJy/Jt6Bt/ABSkPyvh0b/FWB5U X-Received: by 2002:a63:d503:0:b0:46e:9bac:6d9f with SMTP id c3-20020a63d503000000b0046e9bac6d9fmr19089487pgg.217.1666615308239; Mon, 24 Oct 2022 05:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615308; cv=none; d=google.com; s=arc-20160816; b=xKKFA9fdadk5WPEsqt+zHibax5JmLnXc6vo9H3IZT3LBlNUtRI8zcGe2ncm5BTXS4R Wp4UOPRnG3bYJ0ncOH4A4QC9oeA5jhWKC2MHhkKE6Euexh4pETBAEUwJb882ZLRPLHAg /D0cfqSCSpfjPU2LM3ZqHVkJ+I+efpnlJk3FcnwfLcKpAngDA6mMbd1W7hpufby8HjJ9 h1Tt6ccEmi/bd/bbKM9jVLcKLOhnZCj7EvhJZ6NO0mHTtdfe6V0yi1PbiKsqhbMRWwPU MSmd7fgyUDi8LKV1o/jKJKCpOXsuJAtnLCmBnmXpSiIZSPfBRKu1MF6+n0yqrmodVnlT Cofg== 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=HMB8cwFxSZQq5hiwUjnCgLByHbQLvV/Q+JayaXkVQiI=; b=PcQRbd3Svq8oQCrmB+opiDtAL6YcHT+PD4mQuj4nBFCIqFAO2IHAU5wy9/JkVGNsYN 3mL1RCXTMi0Ijhqdk2HSRA6QNDaa+CakZMVFvkB6ffQwtwbktslSAKzrOz8CbwSajNec DY8wBQ5G4xo2UQ8nl0c+ITrQAuqRa64elBlFhCZTvkih1sztRxGyhisd7AgdAdB5jb0B 7rFH0ILcz83h1M1TMoOX12Dg5CIMjqbpwfHdDtwxXETRwIALBBCD8bbyqGoQt0gH1ASN OtbZWg4mPMXv5G8nJokYS4nHMhFVECK+UcUlEXe+aGB1b109buCpjEJTu4/nR+V6a0+K uotQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ww+TW2Z/"; 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 p2-20020a170902b08200b001747ed48ee8si30621508plr.150.2022.10.24.05.41.33; Mon, 24 Oct 2022 05:41:48 -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="ww+TW2Z/"; 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 S233920AbiJXMbp (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbiJXM2w (ORCPT ); Mon, 24 Oct 2022 08:28:52 -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 71DF0868AB; Mon, 24 Oct 2022 05:02:31 -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 AF701612BE; Mon, 24 Oct 2022 12:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996DEC433C1; Mon, 24 Oct 2022 12:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612925; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ww+TW2Z/dWGTAQ3EkzTR3hc5B+ssnbCMnVRmTsxFYpcZKjUDAhN5W6AiMqOu1+ojo ZMdG/iZqKQoZBS3IJVrxPTQIS3D8JcUPfcYpjr/Mgb87yEzSDvYrEZBtfv/y6XhZwT fWnRaOGFP1JrOMQLje79hQBlHy0kuB2XPxbfYBBk= 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 4.19 171/229] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113004.623502859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747572813253815542?= X-GMAIL-MSGID: =?utf-8?q?1747572813253815542?= 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 135a5407f015..d26d9a6f6ee7 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -85,7 +85,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; @@ -162,7 +162,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;