From patchwork Mon Oct 24 11:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp544593wru; Mon, 24 Oct 2022 09:32:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GMFingoEG4YMUgclX4LvzLBqs7MrvitdSHWI00JbnMSDPFO1akYCg1WcD5mDV18eoGW4D X-Received: by 2002:a17:907:2daa:b0:78d:4dca:43e with SMTP id gt42-20020a1709072daa00b0078d4dca043emr28417026ejc.134.1666629147398; Mon, 24 Oct 2022 09:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629147; cv=none; d=google.com; s=arc-20160816; b=OqJDXd/EbKnDckwLfjK2RRtNw4zflprgvpz1bFVEhrHIlv/mFZKRqrVAvcldNffxjr 7+gI8oQaPev/PpRNm5wBG+cbmZRqtNPtYrCjgebLpyDx7P4N7oG7ctVF1ri8r9x3sQfb rm30L2VDqgeMp8mnpVFgnP4Y5mC9Wpaguwmm78NbrSRpVSI9jGOxKhK7Axbxzhlmilxh Li/XBs5/1Qo/rZ1Q5Msufl7WdxGhQ8yMUP9zIWn9S7yYcUl9Dqu7Gcn2y48Tj3mFXuMt eX4bWdbGdE6YgHegB0qkYVCEE/WEnoHpyW8pG+jlrMyjklZ1QryFJNCUQ0UzPnEvgx0b 5Qsw== 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=y6kqJwXHfnRQteEojoHAQGGG1RoDB3H4YLiFyYu7DCi3gE7CV4yZk4j0pqWHX8KmYl KaT8O62HrL1Do4xWc+cA+qR93miX9tJOXY7BlpnP5nVQLTxMJuixwCpfpsKI8kqsuR0Y 4vfj7fPg7HZrYJneAjDheZiSzlxEDtxvfCAuMXFmmfTMcmxXAv1ELH2GydlYhyBYfDZC ajRnmV34bFl46RDS+mrzezT8CU2aZ3L+KNSA5rdicvhSQLeVpq2KZSZw+YmmWW2CEUJT V3+ZLJ2DkKgjoD2YfD+OoZU8Y0I8T+FfOOQkYLXu01VKie5zX6s/xHoD4sMptMKWDVMk Akog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ogyiw3UG; 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 a18-20020a056402169200b0045c9904fdafsi173632edv.74.2022.10.24.09.32.01; Mon, 24 Oct 2022 09:32: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=ogyiw3UG; 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 S234137AbiJXQQ0 (ORCPT + 99 others); Mon, 24 Oct 2022 12:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234389AbiJXQOt (ORCPT ); Mon, 24 Oct 2022 12:14:49 -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 AA16A13F36; Mon, 24 Oct 2022 08:02:29 -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 AD576B81611; Mon, 24 Oct 2022 12:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4B90C433C1; Mon, 24 Oct 2022 12:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613674; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogyiw3UGYFWGThVXqst2NGh83VwNsxJntzA7X6mn7uksyyCdNZUphR9U8n5+53ikV fONNJ8o07u/tvwzRLMLSWR5IlMJ70gIXh582Mc2W2YwY9V7/rN/dxz/cRQVAoSS7/g 8jWZH7QFOUecdvWtBgAhdnuA77H6mNCNfA2c5pV0= 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.4 186/255] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113009.118456625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747587325023350712?= X-GMAIL-MSGID: =?utf-8?q?1747587325023350712?= 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;