From patchwork Tue Mar 7 14:04:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13163717 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 98B13C678D4 for ; Tue, 7 Mar 2023 14:26:31 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tmqyr1bN3w5N9N1zhYxoopUvofOXVoYx0IL5X/25GOw=; b=JXYxfYKq72qCOG kX1/KhcfMjQcB1I+bmW2q0xqF1C1fl2YA1nRw9CiNNyYhVPAX2sbB96THxn28kJazW9cHiMpAqbCP ZXfb7Y6KE/cTr2zLvA161B2Pja52Vsy6N49LO/dqQeFoW8MgcTVjjYHVloTeD59Sy2LUwUaIHXSGb TAmmRUhBJXOFJYRYF86h68Hhq5hFVyvJFbrdmDyga5b8Mvu//UBdKDt8XyPoc3klbdDm9Hfw5zZKE gyQJSJOUG8FKHAoJCw1Q3q/8kia2iVAxxzIqBGX68H/XqCOYmmJAQp/lBx9LJzcEGScAjc3Jdjwz0 IVF6pHc9Qtz9WD+NnzQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZYFt-000lyp-KA; Tue, 07 Mar 2023 14:25:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZXyK-000eA2-HF for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 14:07:22 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id BCD6E6145B; Tue, 7 Mar 2023 14:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38B4CC4339E; Tue, 7 Mar 2023 14:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678198039; bh=7Sb3pK6D439uyI1XL+ABWWcj41jxBle1rc2gq0YdsQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tixza3fh2iLkW/0IOjwq8L0ccv12ajKwiWMFqjfERXEu7HSt5xQM4RMYD7XEP+u79 cfhBU+nzvjZBjDx3bgCjXKLyksXOKPU0r00+EubWat9SsXgv5itENFu5pbP8S+Khok +i+XwncHtc+7xzoTav3Op9UyxCrW9h3ACRAAPn7/c519u535tcluevGZlBqZfYgX9B X+gchjw4P+K9x/PifAighK4hf1I3bqYuN8DvEACQkc6nF/m9Rf3N8Rv/ACT2rD4Wx9 S2Sixivicqys7VHcN5FR6vb+p1YnTRFtbefl8HAaPlo4LAKcCdMyLzU6vYx2DNRWe+ A8ZOrhygGINOw== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: [PATCH v3 17/60] arm64: idreg-override: Omit non-NULL checks for override pointer Date: Tue, 7 Mar 2023 15:04:39 +0100 Message-Id: <20230307140522.2311461-18-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> References: <20230307140522.2311461-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1672; i=ardb@kernel.org; h=from:subject; bh=7Sb3pK6D439uyI1XL+ABWWcj41jxBle1rc2gq0YdsQ8=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIYXdRd1lZ7VMw4MrKsxPpF5dipOxfnDdPsrv7sykWMHlj du3/JLpKGVhEONgkBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABMpD2b4p/h4qfT+1/9YMlfO CFV51uRQs1Rtrfrtf+2ZbE4/Zc+EOzL89/g4f2FIxvHNs59XOy5bYpC4UCGBU+7KpFPbGLQa2ZJ kGQA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_060720_695234_3D93EB3A X-CRM114-Status: GOOD ( 14.73 ) 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 Now that override pointers are always set, we can drop the various non-NULL checks that we have in the code. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/idreg-override.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 434703e4e55cb785..b6e90ee6857eb758 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -196,9 +196,6 @@ static void __init match_options(const char *cmdline) for (i = 0; i < ARRAY_SIZE(regs); i++) { int f; - if (!regs[i]->override) - continue; - for (f = 0; strlen(regs[i]->fields[f].name); f++) { u64 shift = regs[i]->fields[f].shift; u64 width = regs[i]->fields[f].width ?: 4; @@ -299,10 +296,8 @@ asmlinkage void __init init_feature_override(u64 boot_status) int i; for (i = 0; i < ARRAY_SIZE(regs); i++) { - if (regs[i]->override) { - regs[i]->override->val = 0; - regs[i]->override->mask = 0; - } + regs[i]->override->val = 0; + regs[i]->override->mask = 0; } __boot_status = boot_status; @@ -310,9 +305,8 @@ asmlinkage void __init init_feature_override(u64 boot_status) parse_cmdline(); for (i = 0; i < ARRAY_SIZE(regs); i++) { - if (regs[i]->override) - dcache_clean_inval_poc((unsigned long)regs[i]->override, - (unsigned long)regs[i]->override + - sizeof(*regs[i]->override)); + dcache_clean_inval_poc((unsigned long)regs[i]->override, + (unsigned long)regs[i]->override + + sizeof(*regs[i]->override)); } }