From patchwork Mon Oct 24 11:32:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp641996wru; Mon, 24 Oct 2022 13:37:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Z3ZNuuwTfDW7A5nBdJZfJef+kokDsksJvpiz/luByCkMBetyQgjOHNeWiqlZrQ29PVsH+ X-Received: by 2002:a05:6a02:186:b0:431:25fb:f1fe with SMTP id bj6-20020a056a02018600b0043125fbf1femr30441421pgb.130.1666643825492; Mon, 24 Oct 2022 13:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643825; cv=none; d=google.com; s=arc-20160816; b=PFM6S7m6VAHO0SQCOmIbDJNC7GKeQNqVQwFA2n1jmwSaPt0n0zeQJbsmCQWkEWB/hs Zy1TAZ+F9/mMYGePg9LqDAvHdWzpFhJt8X83oe9g/QZ3nvmxJLctruxa+yWDid1vodWc uK7BCrnaU7/iJGZfylW35sNE47JPAJhobQZNbcU4iJ1Hx/xNuO4I/7PnrCTFIgJfMkfW 1sNuozGnHgvPcE9k3vlxI54+Os8t64kqHfjhT/9uDkZweKXqAKEm6CgUkMPYjsO9eSCC 8MyUDJoCjOozf7Xs/Iz93MapqnTF410YuLg/njNWniBchus+XCSD36gpfpt7KhqtLkkJ 8FGA== 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=f80RdvYLhvTAVR3P3Bw9zKIbAfB5GF0D/Soc9uxZKkk=; b=V0eRzGfxwuA8dRy4Ilpj4xgWckrFcYTEV0+kfcjWhvfrm8Y1DyPUDIh8QckrXnoBPE P3cruVVqZmLlTjWuWlptYTTEdOL7QWD0Fmtt926rgAh/RZMa7UuHNt73HqbMz/ei0i9W vl+9VtCQltOzQoGpdYE5eV6tctNCFU48/Arvk34nTJdL8bGjXfdBjB3uDEnUfxD4JTgV 0Mcj5SIK73aFyk0w3ZcR821LoyApZLriWfi7jHgVxHbjgwNsp4RLKr/eEVW2q7AP2rNK zAhESLPznMKefrlS974L5U4k7wyMdGJEiPg13x1VMC3eCjM6qRh3nTtVnom3AGf6pOxW DjlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SICE5gKS; 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 i7-20020a17090aee8700b0020d67aeb299si9181516pjz.53.2022.10.24.13.36.51; Mon, 24 Oct 2022 13:37:05 -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=SICE5gKS; 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 S232109AbiJXU34 (ORCPT + 99 others); Mon, 24 Oct 2022 16:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbiJXU3C (ORCPT ); Mon, 24 Oct 2022 16:29:02 -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 9A29D2A267; Mon, 24 Oct 2022 11:41:33 -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 14B91CE1357; Mon, 24 Oct 2022 12:50:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0292C433C1; Mon, 24 Oct 2022 12:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615848; bh=sm/LDBBuPWty4rPPEEqovbTw/jWuPeNCGNYMtE2bPkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SICE5gKSh18IRD7waSWDtMFrM8yps1JRTZXzBtKb3wkVN9yNDL+6c7nUVsPBpkDrl q9ylk1JW6Y64CFANhirzOIQW1QQooqcJLUDsFHLH2TsIAVHJG/tGIdqb+hNlyL7RVb SOb780poleLpZCa/j2V9ra1rRwUng+n63eHLe82c= 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.15 407/530] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:32:31 +0200 Message-Id: <20221024113103.492757352@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747602716021179872?= X-GMAIL-MSGID: =?utf-8?q?1747602716021179872?= 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 0a63721d0fbf..5a33d6b48d77 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;