From patchwork Mon Apr 8 07:37:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1920665 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=2/H2beyi; 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=a9ywlagb; 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 4VCgt309fPz1yYf for ; Mon, 8 Apr 2024 17:37:47 +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=e4giEMk8XP10lIvJjKJZSrJQtON5SfKZ+PjbI7U6V3c=; b=2/H2beyiUwWNWi DW7HY2NmiWclcvzxESWliM3+R29zTlfwHCA0a427EM09TaAXn/eHwUouojLvfJLy15TYz1sXVUXDf 9JOVBvRCEg8vQi652gSGm1697a4Gw5IfI2+fexHT7DFOr+3nWnSeD97Qx8h6iSm995jOWXd1Ar/OB Dz4xWc+W9zve0WTcfP8Lis8WeASLaYTpgHHPXykymO6r2XK3qPJvX1VB9BvW5/n65HKXajyBVvnxc jUFaN5BiRzsN3jee7UYeqT75SMRCYm7AdhbSw5PeBOV0MJM31wQYGHH5VOYJGWVPc65c8D+izpkKH 8zwbgt3i9pLuANUcUUMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtjZT-0000000EgnF-3u4h; Mon, 08 Apr 2024 07:37:39 +0000 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtjZQ-0000000Egkq-1Ug3 for opensbi@lists.infradead.org; Mon, 08 Apr 2024 07:37:38 +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-0.canonical.com (Postfix) with ESMTPSA id B682E3FB55; Mon, 8 Apr 2024 07:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712561854; bh=LrD7KNYdcgChOMrzljGb5dcypuXKOAwwDz6d0C74y9U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=a9ywlagbIzXys5VEbL3ODeyLGNp9qwhjbFe8ruSXNtfvto5WmPUvLGw8tP9L79rZc LDDvQuS1c6hYqUikipeGNpyv0/yJuXdOpuRepDGTvbocg1ZG69cLc23p444gu0Wduh 2qHmpHgmSkfIthCMpex1Bwrm8bK54+yDemow0WTivEoOFOLg3BOYvzFNu9/iVIFGhc tymYWsZp5zUcIfCWxURs9CkTtfL1qL56/mVOpSWOzgtOYliR8QbhV3MHYzIZs38pRE asknWROmkxyzRhFyhk/VN8ffl/vKOIkKSEQfLAQTka0HxpK7JbqsPsuZV8hCPaBC4J 0UoTJz/mUC9Wg== From: Heinrich Schuchardt To: Atish Patra , Anup Patel Cc: opensbi@lists.infradead.org, Cheng Yang , Heinrich Schuchardt Subject: [PATCH 1/1] lib: utils: check correct value in fdt_node_offset_by_compatible Date: Mon, 8 Apr 2024 09:37:32 +0200 Message-ID: <20240408073733.49356-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_003736_669994_1268F682 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.9 (----) 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: After calling fdt_node_offset_by_compatible() we must check its return value and not an unrelated value. Addresses-Coverity-ID: 1584993 Logically dead code Fixes: 67ce5a763cfb ("platform: generic: Add support for specify coldboot harts in DT") Signed-off-by: Heinrich Schuchardt List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org After calling fdt_node_offset_by_compatible() we must check its return value and not an unrelated value. Addresses-Coverity-ID: 1584993 Logically dead code Fixes: 67ce5a763cfb ("platform: generic: Add support for specify coldboot harts in DT") Signed-off-by: Heinrich Schuchardt Reviewed-by: Anup Patel --- lib/utils/fdt/fdt_fixup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index 194e55b..974b1b8 100644 --- a/lib/utils/fdt/fdt_fixup.c +++ b/lib/utils/fdt/fdt_fixup.c @@ -394,7 +394,7 @@ void fdt_config_fixup(void *fdt) return; config_offset = fdt_node_offset_by_compatible(fdt, chosen_offset, "opensbi,config"); - if (chosen_offset < 0) + if (config_offset < 0) return; fdt_nop_node(fdt, config_offset);