Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp878789rwi; Wed, 19 Oct 2022 04:13:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yki9J1eRP/RP1i+BkgpTve1rWYeROjR/OD+RCY1sNzYMV6wJn0LSJNjlNcuLHnShi6xMr X-Received: by 2002:a05:6402:428a:b0:42e:8f7e:1638 with SMTP id g10-20020a056402428a00b0042e8f7e1638mr7012861edc.228.1666178025320; Wed, 19 Oct 2022 04:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178025; cv=none; d=google.com; s=arc-20160816; b=CkTX92WK8mn6GNpSW4kg3c3Ahw94qtaef1swPDjRkB2OabVgINoi4SxTjflqqRq90G 8n7BbHtyXzALbnLZYbLKzP4FwbW3UUUurxHRLnkdoqYeExFSgs8uYAP3s+zTcJF+Txzu B5UeeLTM3v3Y1nUq+03kUOYi4Mhhnn8D5fjHENjctokFyG05oOqqkid68s3Qg296/9+D 8p5xKh/+RsMGITn+0K1QL/MS6lHhQU71UhCrRfFuSimfbM5zMBLPShseiIin7VrpjCON cpV6/5yGcNIc6wS2Vab6Famq+LaEYUqgQezpsCSjJKCt+gs16TLufPbhQAbtYQKUorWw Mh9A== 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=dn40mAEd+ueLEc57uBzBl/9DVPEVHFPbbZQ1FkYTyKw=; b=NnQuIalfTvaMAX9Gd1zkG0cesNmyc5Hs1+DpjsZ80tZIfcks2BJIS8yz89zvFpVXVk HDMg+pVN9r08WVOHVHOhTsZeAlOcAhpcVbYbwiTNFxWKDCj+3Y4azKakZ7o47UT9lD1d 5RwdUleLUZBurscp4zKrlVO4yNW7cxqwa+iU25pbazUmtiGb5h+960ggWqjoz+NFTQow L6TnDssoFVBbbYdRyGu1bLyTosvMpHExZurOALXaLOTWgCWIm71VSzQBVJ5Kyls2r2vG AGpzuh6i1EPvcO7Qhs+VngLWTdriXvMPYqfcZN7JW4XtpE0PcTHlRXOSV8Ac1hCPLT0l mu0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b7rPBevF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc42-20020a17090716aa00b0079194297b1bsi7389660ejc.815.2022.10.19.04.13.18; Wed, 19 Oct 2022 04:13:45 -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=b7rPBevF; 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 S234667AbiJSK63 (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233118AbiJSK5M (ORCPT ); Wed, 19 Oct 2022 06:57:12 -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 CA6EDF53C9; Wed, 19 Oct 2022 03:27:55 -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 2BF33B824B3; Wed, 19 Oct 2022 09:09:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 505C9C433D6; Wed, 19 Oct 2022 09:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170592; bh=SLEl1ykAV5RDsgLc/AeCBHJhHpc6G+47h6ZWYxuzlL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7rPBevF4BAmii9z0JKcKKfeLsKndZp/XOU6zDNuQGxWlBvpSxZkcOe+GDKx8I4wf AI0YKn31hrIgk098m6DSkWO19WTeLFCHgUTo/xZRrUpjw2w/8Jaxqh4BozpQUZQJh1 Xtd9RZSDEojEGcgJPIeznTt9ieNip3v4L6UC5SvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev, kernel test robot , Kees Cook , Sasha Levin Subject: [PATCH 6.0 671/862] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Wed, 19 Oct 2022 10:32:38 +0200 Message-Id: <20221019083319.597586557@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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 ab203e66ba0d..a9bea411d928 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; -- 2.35.1