From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A81CC43333 for ; Wed, 23 Dec 2020 02:25:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C1D722248 for ; Wed, 23 Dec 2020 02:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730306AbgLWCYp (ORCPT ); Tue, 22 Dec 2020 21:24:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:54422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730244AbgLWCYb (ORCPT ); Tue, 22 Dec 2020 21:24:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D65F229CA; Wed, 23 Dec 2020 02:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690231; bh=9t5Lcnm0f4vevU91/fZxdhnZH5+049iIJa37J/0dzZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhDOxQD/PhnFNsUCiiLo7v4Xcmhbo0umx3unOH45+BR9R5+r3H2U2OYuJZR8TNTT7 9xf412xWzwCFirTQ6kvkS5rDf2LIhlaRcbmcYTWEmKxGWbuywr2BezsK7ux/7QChjf Dsu6GSKj78fyi5y9Ad68PtqIscceIWlTBgv1xleMAoBgjAfgnTqt3Vi9U5BoxmM1VE iUIkYw2QWvSgHFRB2lyOPC3ZNFopoBFcFtH9ic8FDspx+WzFpSRcCnM0ks3xU92Ifd aPNQeNmntvIbe/GIC4MUI81+XG7h+tt7Hq8/SYBdgiog79zXNbCx2Si9Nnt+F5BafJ BUfE8THCobhZQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sami Tolvanen , Sedat Dilek , Borislav Petkov , Borislav Petkov , Sasha Levin , linux-pci@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.14 46/66] x86/pci: Fix the function type for check_reserved_t Date: Tue, 22 Dec 2020 21:22:32 -0500 Message-Id: <20201223022253.2793452-46-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sami Tolvanen [ Upstream commit 83321c335dccba262a57378361d63da96b8166d6 ] e820__mapped_all() is passed as a callback to is_mmconf_reserved(), which expects a function of type: typedef bool (*check_reserved_t)(u64 start, u64 end, unsigned type); However, e820__mapped_all() accepts enum e820_type as the last argument and this type mismatch trips indirect call checking with Clang's Control-Flow Integrity (CFI). As is_mmconf_reserved() only passes enum e820_type values for the type argument, change the typedef and the unused type argument in is_acpi_reserved() to enum e820_type to fix the type mismatch. Reported-by: Sedat Dilek Suggested-by: Borislav Petkov Signed-off-by: Sami Tolvanen Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20201130193900.456726-1-samitolvanen@google.com Signed-off-by: Sasha Levin --- arch/x86/pci/mmconfig-shared.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 96684d0adcf94..ec63c1e622d77 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -424,7 +424,7 @@ static acpi_status find_mboard_resource(acpi_handle handle, u32 lvl, return AE_OK; } -static bool is_acpi_reserved(u64 start, u64 end, unsigned not_used) +static bool is_acpi_reserved(u64 start, u64 end, enum e820_type not_used) { struct resource mcfg_res; @@ -441,7 +441,7 @@ static bool is_acpi_reserved(u64 start, u64 end, unsigned not_used) return mcfg_res.flags; } -typedef bool (*check_reserved_t)(u64 start, u64 end, unsigned type); +typedef bool (*check_reserved_t)(u64 start, u64 end, enum e820_type type); static bool __ref is_mmconf_reserved(check_reserved_t is_reserved, struct pci_mmcfg_region *cfg, -- 2.27.0