Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7473144rwi; Mon, 24 Oct 2022 15:23:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46ViOw0BgyL/VshM5YLjcgms/GX1MzDNVKzpkDmFT2M7Mqa2QBzhC1tsq8+Gn67vEs31/y X-Received: by 2002:a17:902:c209:b0:186:67b0:b1d0 with SMTP id 9-20020a170902c20900b0018667b0b1d0mr24359298pll.129.1666650207400; Mon, 24 Oct 2022 15:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666650207; cv=none; d=google.com; s=arc-20160816; b=DxTe4nxskrVbbVgZUvi+Lq47ThDwsPP67uuejqyYB04MFYxMOgRU2Ty37xIb/Pho3O Me6NeRX+s/QeHbUSQ9pHslENCM5b0fzVFJUiSJQ2YVxd0wcP4hLqS+9zQ6qUjlwiptgA EW/mWYo29nFkpRi7V/KoXJSQbUmxJhbC7Xduf09xjpCyPSnvYhy4qKyJtCG1AkJLWrJv bVa7zJvBRN87BFTz22BylS06j9uE15/Vv7MASLOKKd9VYsoP/yJhr6cwL7OQwtLvIJL+ Pwfm5kldExvFXmgkGNyhdTyRSpIk1UJy3BRXlyJXy1RI7muEWkAe5kLXSrAz1cYEqqJP DM6w== 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=i4Cd4rSm3uqm6FaYX6qvs910FFqjI8sHulHGKR68OsBM0nDt4H0RNwDsAEih89V6Cg cdIAIA2bgntem5tBZ4FNUWm3u3il2uFqTyKsfnAUyLIfnS7s+LDKtf3g9GsIUd3Ew5VZ JA/pM/64mGKMDs2cT02X5z7DstcC0q/pLcEToFFrXTmWIOY2IpBRh+DTE7My7H0SkqSg AVWWKuPWeGnl9bGif3AWM8wNm/75xKPOS4V2YjvjtPW5s1VlaKLoCHadctgZRyFC/JdO Ybib0d5qIn6Um20/2gDyOhzLZXhPbuZ1pmRSuO9Xl0eET7HmgDBkzZ9z5zhPPwZUhxRd 8zlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zphT8N3l; 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 s23-20020aa78bd7000000b005633c373dcbsi986511pfd.147.2022.10.24.15.23.14; Mon, 24 Oct 2022 15:23:27 -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=zphT8N3l; 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 S233587AbiJXVMJ (ORCPT + 99 others); Mon, 24 Oct 2022 17:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbiJXVLd (ORCPT ); Mon, 24 Oct 2022 17:11:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C2B7186D4D; Mon, 24 Oct 2022 12:17:19 -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 sin.source.kernel.org (Postfix) with ESMTPS id C23FBCE1355; Mon, 24 Oct 2022 11:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735B4C433C1; Mon, 24 Oct 2022 11:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612345; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zphT8N3lEmzRyWQCh+kWbXIaAtR5Djp+HSSF4tsRNJiC8pZLsO+ZZXx4ZD5Pz+lxr Ujx4VnnJluMgLMXENuyiy3Xz/PVPXjiAUsQpLTEEe8o+mliAXDjyZGOosHOwgrgVwX jfV+1QIrGEePQTnbF0CtSCyI0B1Mt4MdbUZm1Ghs= 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 4.14 162/210] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113002.229290480@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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.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 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; -- 2.35.1