Message ID | 20221111171201.2088501-15-ardb@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 7E675C433FE for <linux-arm-kernel@archiver.kernel.org>; Fri, 11 Nov 2022 17:21:51 +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=5kgaRFuaVAIzm9iGb/I/GmkZHD+Rr4SgdJquB7wyJ+s=; b=DK/a0XAGZ9WzBl V7jOMvlq+RKPII1SDWgAbhZL3h81j/zoVxzNbuZViX5PscPzTqiFI0DyPbc0KRhHsLZQygFQfAIRF geFaxPwqpK6RttgUl1vmwiVacPKBd4E+VSfE+LuIhLttVsbZSv9hUi+B1w8OoEmMCxseZmvgOvpvH SZU/gVGjW2m0GdOu0hrrFuy0CSQbbtQMcfC3kNd3Fvq7pnDDayJUS9Rf3VHkF2BKi5ZL9V9F9EVA7 Xir6bIzf6l5h+0Zkk3Q1+fOQopW7H2hu95mI79iUTWFfjD29Z5Alatp4YL3syBMxdOl96vkqC3xqD OT54y264gXfJCWEnttDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXho-00HC9h-Dg; Fri, 11 Nov 2022 17:20:40 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1otXaG-00H7kv-9Y for linux-arm-kernel@lists.infradead.org; Fri, 11 Nov 2022 17:12:54 +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 ams.source.kernel.org (Postfix) with ESMTPS id EFCF6B82680; Fri, 11 Nov 2022 17:12:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF290C43145; Fri, 11 Nov 2022 17:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668186770; bh=5HcnPAIJ4QPJNoy+UnmbfcBqA20mwt+bVYXNxusD5CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ztj2e6AaqM43kHl5/vCfPeNXnaRbevz+Mv6O9XB3x7oKfXA2oWgurYS9wp+7s9TAZ uXbzvw5tEgkwDnvLlsF7nbQJuo9aP04E4wIp0vuBomkaHFnq16sMFbMhP2NuYcp0xj +r5X3gwAAnyFMmDh6Qtj5OvC85tdboYXWN4P09lPyZdIaEPy4am8KffXWAHLYzbBEN 6dzZajgFPqLhH868cl4HYHQ/Ga48qsytQf9YZGoQDx2BMMXwpfrgV5VO6ZQh0VbfpX TKFRcJ685dQl/Kg0Tfav3Q3QCTR07c+hKI2M3P+S/rkMVLGCiGU+U95egv/8M5yTiY k1F3OXO4Q01kg== From: Ard Biesheuvel <ardb@kernel.org> To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel <ardb@kernel.org>, Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Kees Cook <keescook@chromium.org>, Catalin Marinas <catalin.marinas@arm.com>, Mark Brown <broonie@kernel.org>, Anshuman Khandual <anshuman.khandual@arm.com> Subject: [PATCH v7 14/33] arm64: idreg-override: avoid strlen() to check for empty strings Date: Fri, 11 Nov 2022 18:11:42 +0100 Message-Id: <20221111171201.2088501-15-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221111171201.2088501-1-ardb@kernel.org> References: <20221111171201.2088501-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=926; i=ardb@kernel.org; h=from:subject; bh=5HcnPAIJ4QPJNoy+UnmbfcBqA20mwt+bVYXNxusD5CA=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjboJAbXeCuRGUNf/99EalkD6+whsstqSdpjrLb/PB qnb9ZaKJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY26CQAAKCRDDTyI5ktmPJPiiDA DEyKletnnLbMWfbjAebEc2KMs/21ybY4DtA4ArbygcvEJv/6wH+6VpXMtAlNNRFve4sA3OXSXVlkWG X1wgmP73HT1r6jSqGeq+rn2d7ED1G9JC+0eTZgf4F8NsvcSmQ5hlZqdSsiUoxSYTowi/3CRIqBseHR y+NQ3Kv60ANbBZyjsfbMK+XiujLpMlg4v9SJ2iOHyiQ1wkXQ8cb6XlsQBz8ex3ob131yxwwxzCo4hN 90GawOZbdHU33bvGpAs7lM77KuREoi7qhIGdlC0sLS6s3iwneBbKXuMd7lZ8rRv3EbPonrLGpRRI0o yw8BvjoSd5Rz0qyJc2MCZWU23W7PQ/nTlK1um+LCjxVveOMsRpuOx9fLhEK7Z2ucFMo/Cl5xCjBFEZ 9Rub8ZpAdJ05JM+XEqDrYDcCXD5sg8etRkCF1p96GnkNFCPkbbh1R4mc8vqhq1mDQcaR/XaEv/+8tt bGU98bjMh6WkfuCYtvRenF9j08o/TN2/sf8p291IVZMHI= 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-20221111_091252_530494_C4A2D1C0 X-CRM114-Status: GOOD ( 15.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64: robustify boot sequence and add support for WXN
|
expand
|
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index b3288e827a6bbec3..97ec832d87d44f64 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -196,7 +196,7 @@ static void __init match_options(const char *cmdline) const struct ftr_set_desc *reg = offset_to_ptr(®s[i]); int f; - for (f = 0; strlen(reg->fields[f].name); f++) { + for (f = 0; reg->fields[f].name[0] != '\0'; f++) { u64 shift = reg->fields[f].shift; u64 width = reg->fields[f].width ?: 4; u64 mask = GENMASK_ULL(shift + width - 1, shift);
strlen() is a costly way to decide whether a string is empty, as in that case, the first character will be NUL so we can check for that directly. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> --- arch/arm64/kernel/idreg-override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)