From patchwork Mon Apr 8 08:05:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1920679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=rilhVXRv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=wOAjMu4g; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VChVr6HsFz1yYf for ; Mon, 8 Apr 2024 18:06:12 +1000 (AEST) 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: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:In-Reply-To:References: List-Owner; bh=I30fFD8GiyUxqyoja5qkv3OHIJYG7awvJwN0gFUyB1E=; b=rilhVXRvxpyuhx 6aBrNq9gRB3JKN4MqpGC54c93y35fCOhv3TiBgt8bZ9TQEdRzTvHt2zFEzsU3xLTjCpHod+VVCgi3 0RsQgsGYaLNOh0McCSDArFeAisG2w8qgV+wHQslqnFwvgDWgOc0S+OHIynR2F6kh47i5dhKP4Ak67 g1BXSxXN3byosnTbngONn5otSVq4nQ70SGasBEL2B9zOaviz2Fq5kIxPKC0FYSyCfXD4uFeGWL921 2/VFL/F6zrIeJVPsT5qIavIM5DOlr21IcgwT3BjqRMoO5px2aW34slLykfhbyC+MwOwzN0/qlD4UB 61s2wv5oVkoZ2TthFadA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtk0y-0000000EpCl-0Bt6; Mon, 08 Apr 2024 08:06:04 +0000 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtk0t-0000000EpBM-40gk for opensbi@lists.infradead.org; Mon, 08 Apr 2024 08:06:01 +0000 Received: from LT2ubnt.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de [62.143.245.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 476BA3F101; Mon, 8 Apr 2024 08:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712563557; bh=GaPQY6P7E/EjNTHrlVggnbKx3bUm9MC7j3AQt6z7n0Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=wOAjMu4g90RVRR3pRuQ/1zgVpEj+po9LNP1op5tlNHTkIcI+Z9cVMaxN5MMuo143p xIJgjgavpFYnCJCrEx34ifZjbHQvhlesqU199dllmelWOSJ+2zidgqZwBMhQ4vsuEF tF/SIuwuQyl4K/jRuhzMmZrqx9cWoQ/Acp39GrJyU8WI5r1b26vdV2u83b/TINSNTm 1LZhlt1UQFw11Xjh/ICsF3OmmmkVHJsgLvKvxU0ptHZCO3WK5GFIhhEvSF5TewJ4S2 IJi4TPN8Eywz8Mi9j1kLbjlpb53cyA10eRKE+FHmwYyKtLO70EmqWWXMw4/WnV/D7G dGp3TsSa1XFvg== From: Heinrich Schuchardt To: Atish Patra , Anup Patel Cc: opensbi@lists.infradead.org, Heinrich Schuchardt Subject: [PATCH 1/1] lib: sbi: missing values sbi_hart_ext[] Date: Mon, 8 Apr 2024 10:05:51 +0200 Message-ID: <20240408080551.50655-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240408_010600_351188_78A6D81B X-CRM114-Status: UNSURE ( 8.00 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.0 (----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In sbi_hart_get_extensions_str() we assume that sbi_hart_ext[] has SBI_HART_EXT_MAX entries. * Add the missing entries for sscsrind, ssccfg. * Add a static assert to avoid future discrepancies. Addresses-Coverity-ID: 1584994 Out-of-bounds read Fixes: 6bb6b61c27eb ("lib: sbi: Add support for smcsrind and smcdeleg") Signed-off-by: Heinrich Schuchardt --- lib [...] Content analysis details: (-4.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [185.125.188.121 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In sbi_hart_get_extensions_str() we assume that sbi_hart_ext[] has SBI_HART_EXT_MAX entries. * Add the missing entries for sscsrind, ssccfg. * Add a static assert to avoid future discrepancies. Addresses-Coverity-ID: 1584994 Out-of-bounds read Fixes: 6bb6b61c27eb ("lib: sbi: Add support for smcsrind and smcdeleg") Signed-off-by: Heinrich Schuchardt --- lib/sbi/sbi_hart.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 3d13694..abec734 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -666,8 +666,13 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = { __SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG), __SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND), __SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG), + __SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND), + __SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG), }; +_Static_assert(SBI_HART_EXT_MAX == array_size(sbi_hart_ext), + "sbi_hart_ext[]: wrong number of entries"); + /** * Get the hart extensions in string format *