Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5452436pxu; Tue, 22 Dec 2020 18:26:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJz174mgy2XZ0m/wc/e0d6ASwRoM/tnn/IliTbZvjx2pOXj2lLrlqoPgPeklUym5jjYVWX8J X-Received: by 2002:a05:6402:3048:: with SMTP id bu8mr23107159edb.49.1608690391845; Tue, 22 Dec 2020 18:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608690391; cv=none; d=google.com; s=arc-20160816; b=aw2d9mhBKeGOErhlxutx8cjmVY2PF51TtG4MMXJIPqjMkraUzVgvV5IXEPPx+yQaSd 5yXcb8fffGYBJb/FGMkSZtKlg8T5Fz98UyWNCH/08mPm/cJsIbYTXBPfckzGfZV6WiER bkWI6566wreE5Zm+oE2E/zpPYt3O81bbZoLO+3protYI1++TtRDsvx6dHF5OfLcgzMI1 Sijl04evJjh3tlmwCkroTpgLqEnOZZaL5J3E2wQ8aqnhl/eJ1JCo7JfvuAjiDv5KUoqE Br/iBAlVJPX/CuEJybM4SvsFZv3eJ5iNW+fqXwldyvU0k/WJEfMDiXojoqyMN4lybnQe elbQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2CxKheTD9oK3vNE1fOv3Ykpm6TxvIg66IVqfrcRHxbI=; b=XdLN693KUjxD8nFC/BhwSmY7bvILrgq9u8oYqoqCEcIgC/oysovEdveFP0DjXLOcP5 yNnXai2vNdS2yeDlQAyhdSuq9wBY5xADsWQv5CASAh117s5Y5hg/+tuhNebTr2f9umcn egIbFKjisBhFvOUeH3/YWYnsjYKHBH9EixkFvhaeFM74/n/vMriq2Xo/tNVCTd3ZFSLh 0dntahCJ1XYr09VkLAHLxk98r0WZpx5kfFTBfboMOsi0zL9emayUU2xrl9AFXzfPZDgq mqBFWg33Usxh5/TzLNtlfdwbwI2arEaG7jlgB7Pb/Z7AdHtZU9WK+AjNuQKWrg0h58DZ HmpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="jhDOxQD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si12681097edx.226.2020.12.22.18.26.09; Tue, 22 Dec 2020 18:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="jhDOxQD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730298AbgLWCYn (ORCPT + 99 others); Tue, 22 Dec 2020 21:24:43 -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