From patchwork Thu Sep 8 21:54:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12970711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C424C54EE9 for ; Thu, 8 Sep 2022 21:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rb8e3RPcyGP2qpiGqdXpHfO2iZFWrQtRMSBPMYfjsyk=; b=aiE6bnq+AISlbkrNRwUYH92jyy Ly/ZxCmlpaCDDQI0FsANzQAjw/zMOh9f2ZTyHFHRBo0ZbcJxeqtFi+IsJGoJ8ZMhyBFu1INH0J99q DqcqrSyXpgAwqYot2+K6xi4/VXiBOuXKOCTynizrkJXxeS6csZp7NaVPnPcAbdJRUR0JPpnKfDzgA twHmPyi9wO+0ojyGMGm0NN9l5tYnr3ggRypdyQwHKDZnoMR9YdFa0XJMG2qUdvux8kXoHNRVs6HHa WP1otnel+tD0KWg5hiM1kkWe9Nuy3tvhiWPqfFmS7/o0HpHxhWCwiKMbkKlsy38ibtp+uwLhUvnmj Y5RJsqhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWPWg-0096O9-P2; Thu, 08 Sep 2022 21:57:35 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWPUf-0094z5-Ce for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2022 21:55:31 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id v202-20020a252fd3000000b006a8f6c5d39bso10882473ybv.21 for ; Thu, 08 Sep 2022 14:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date; bh=koezPCxm32fHAwZgdGqKK7XqmRXL9JxASzrYTVD4m+E=; b=JSacEPUoej5v/XIN7Hsi8+T5GHAejPEIXTMi6W7AKQLC5hVqZnvtkNAu5BK6krzUQx fctP5X9cs9aaG7Slukq3widQl5Sz3Cg4B2+9Ms/40HHHiPhW+ORwgrMpQFg4g2DD6vyP nsbocmqQcPUoKOu9GBsszyWW5Y/9pcHmD1tong6jGdtvxt1q98M9IMk9vq27vD9xYIlm X5YII9Nz1tn+CVFWxqczzbj3f8cmmHd52JOITZuOclM3trrztiE9Anovjz5avPkqa+tl mNVIYYwqwAqyxAbBXm25Fyh9l2MDmpgRTRoUJ5NAd2cCa7cVJSAWyrMN3tEzDgFbbiIe 6TEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=koezPCxm32fHAwZgdGqKK7XqmRXL9JxASzrYTVD4m+E=; b=oLEJyZrt6RUCojuYiUTWdFzeE8bVGw9SmIMs5zuT8Y7CF1d12AJ32NC5lJTKFe1Qbg IukautdMySHnVTRjr3PjgAaG9hxcoZgEd02TBaXAbJMd7HkTWaF1r1EdTk49EVAj1ojJ K7LgVOOfTxbVmVewwMx7EuVvDICLuq878yH30bS+o8NiMqTAtFRC64aor5q2metJJhS+ XymD2AE0Z2HJa5mRD4k/CMQh+DMw+ECduSE4t179MItUKK+6U4EKX6x/rWRPSbaWmBAj EfN6bpbIcsEP7Nj3cM29j0XVTL8SQZh+3v7fFvC076Xa37ze/GPiwIDD8ScLuvi7vQRW 0nDw== X-Gm-Message-State: ACgBeo0n22aMD0PaWjVnk6cU+n7luS5M9y9a7nVJa3QAxeLk5KPAJgHI kLOXUuQMJQR/3cyvd1ErrgrlpvWEZ8kDrv5JOlU= X-Google-Smtp-Source: AA6agR4f3SYEc+Bp0TdIuCv586ybfdJDVN30qGCNPGKAFJMjsSrHsBG3kNu8QkrrVyppevzh+B3tK1Z4CU58zsMdLI0= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:a4e4:e6ec:9fdd:1bdd]) (user=samitolvanen job=sendgmr) by 2002:a25:3486:0:b0:6a1:881a:5d86 with SMTP id b128-20020a253486000000b006a1881a5d86mr8937712yba.323.1662674128390; Thu, 08 Sep 2022 14:55:28 -0700 (PDT) Date: Thu, 8 Sep 2022 14:54:50 -0700 In-Reply-To: <20220908215504.3686827-1-samitolvanen@google.com> Message-Id: <20220908215504.3686827-9-samitolvanen@google.com> Mime-Version: 1.0 References: <20220908215504.3686827-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=1807; i=samitolvanen@google.com; h=from:subject; bh=jyM+rGxWUU219XYY5/O2nBNl+QplLQ4hASchurrzdpo=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBjGmS0202vID3CXZ0XLmebB+d9NIzgSUGtOWGy99hv ue7C0ruJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYxpktAAKCRBMtfaEi7xW7lPxC/ 9lKOPhgsglfXR1fj5L/0qgYqxVBFIG9R2MnXno1UwVmdTTRPq0bkQzscG3ZpD7ATu2TIr53T1Edqxa yuQxpw1bh5TSssxhwO6IU7t5pOMBdP86oaYB2aEUoAFRLV16cwaX3ei3GpZl9y/mD9QGlDzconUw2f JaNKLMZshc/LblHCMDbxS8I8wIe8AEjCb5QEIxM7P9I2wAPAxx4/4mDDj8ivfGS3tzIMF1EXYYFkv0 wHyzUefM39JrhnAXhKtJ+5JSsakAbxyGBuFX31X5YeQhoOvbR/eqylaRbt7Tej1510BlgG+zIxM4go U3JlUJiPPvWfW/rych3iQYkqRHFcpJLtgshmb3HaA64wvo2hwTTFK82MJeP2qDRxZJPY8gDK0dR0v2 UxktEOG6eZ4oLvqy4bI1mp5dfETqiJ16qfIZ7BPnnCOG71n04ZjUltD6AAhj6pPHqMNHNYVnnUdFS7 OThfxGxDoCPjO+/PYXGv9Mn7QoeBz+hDGxY9/SQR8lC+c= X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Subject: [PATCH v5 08/22] psci: Fix the function type for psci_initcall_t From: Sami Tolvanen To: linux-kernel@vger.kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , x86@kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Sami Tolvanen X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220908_145529_451790_9CA94C38 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Functions called through a psci_initcall_t pointer all have non-const arguments. Fix the type definition to avoid tripping indirect call checks with CFI_CLANG. Suggested-by: Mark Rutland Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook Tested-by: Kees Cook Tested-by: Nathan Chancellor --- drivers/firmware/psci/psci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index cfb448eabdaa..75ef784a3789 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -274,7 +274,7 @@ static void set_conduit(enum arm_smccc_conduit conduit) psci_conduit = conduit; } -static int get_set_conduit_method(struct device_node *np) +static int get_set_conduit_method(const struct device_node *np) { const char *method; @@ -528,7 +528,7 @@ typedef int (*psci_initcall_t)(const struct device_node *); * * Probe based on PSCI PSCI_VERSION function */ -static int __init psci_0_2_init(struct device_node *np) +static int __init psci_0_2_init(const struct device_node *np) { int err; @@ -549,7 +549,7 @@ static int __init psci_0_2_init(struct device_node *np) /* * PSCI < v0.2 get PSCI Function IDs via DT. */ -static int __init psci_0_1_init(struct device_node *np) +static int __init psci_0_1_init(const struct device_node *np) { u32 id; int err; @@ -585,7 +585,7 @@ static int __init psci_0_1_init(struct device_node *np) return 0; } -static int __init psci_1_0_init(struct device_node *np) +static int __init psci_1_0_init(const struct device_node *np) { int err;