From patchwork Tue Feb 21 05:07:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1745429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=NDukhmDQ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=Og/qT5vP; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PLS3G23gnz23j7 for ; Tue, 21 Feb 2023 16:07:54 +1100 (AEDT) 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=QgsAptbXseLJQjrmUSdHVSo7iJRTR0UQVgzR2WNuo7A=; b=NDukhmDQKJ4y3f oDQa7BOMC64K0p9Q2RtVM713Dxm3s+AL+l9CWRx9jgrEEg/e38ied1wDtT6WPoMZupIcPH2tp5agj gjNFL5pEyUttzV0fpBJ/ULDO199I2+R8MT7QkOpNGWanBumVIgF/hXsSEuTJioTiDDsKkqNRLpm7T haX1YZbHmxSQkZ0ophtAq0F2BGc4ynoESqo+IiLoV0JrXoz8Vm+LjqfmbmOOPnB4wRRo7Tvq+oIZh nHNYAbY/J0oqAsQDGzxNQ3oClZKObi9i1CpuJ84lwVPUHWI1XMiAQX2r/vNOfZb4ZpvcwbNyL3zpW uf1fAOaiV0Cfq96BewfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUKsJ-006erv-KN; Tue, 21 Feb 2023 05:07:35 +0000 Received: from m126.mail.126.com ([220.181.12.37]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUKsG-006epy-9a for opensbi@lists.infradead.org; Tue, 21 Feb 2023 05:07:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=5iuBF rLW3Z97FuFb1vuc+JiZS3DcoypRkKDvpUIq2Pg=; b=Og/qT5vPwGELGMxgDXqIT WyWgWwg1ZiOgVyuVVUZEg/Q8n6eJqLv0N9w2NeGUxRowvuWknkmAxQvIiV4Tb7mE cppyYnOp8N6b1e1Y/mfTf/Tb/MoAucCNZo/4dQXbqG1Q3l2EVpM+ru2UR/iaUkU8 zsrEiCPR63vqHGXvZ3J7Aw= Received: from x390.lan (unknown [58.246.230.147]) by zwqz-smtp-mta-g4-1 (Coremail) with SMTP id _____wD3JeF9UfRjpJ+oAA--.49032S2; Tue, 21 Feb 2023 13:07:11 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: peterlin@andestech.com, ycliang@andestech.com, anup@brainfault.org, bmeng.cn@gmail.com, Xiang W Subject: [PATCH v4] lib: utils: fdt_fixup: Fix compile error Date: Tue, 21 Feb 2023 13:07:07 +0800 Message-Id: <20230221050707.825994-1-wxjstz@126.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CM-TRANSID: _____wD3JeF9UfRjpJ+oAA--.49032S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZF43tr4rWryftw43Cw18Grg_yoW8Aw18pa 43K3Wagw48JFyfK3ySqrs7JrZ8GF48JFWjkrW3Aw1UJ3WDJryYqrs5tF1jg3srXanxWFs0 yF4vgFyY93WqkF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pMLvuNUUUUU= X-Originating-IP: [58.246.230.147] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiJgodOlpD8HjgVAABsv X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230220_210732_693273_977B560E X-CRM114-Status: UNSURE ( 9.23 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: When building with GCC-10 or older versions, it throws the following error: CC-DEP platform/generic/lib/utils/fdt/fdt_fixup.dep CC platform/generic/lib/utils/fdt/fdt_fixup.o lib/utils/fdt/fdt_fixup.c: In function 'fdt_reserved_memory_fixup': lib/utils/fdt/fdt_fixup.c:376:2: [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz[at]126.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 When building with GCC-10 or older versions, it throws the following error: CC-DEP platform/generic/lib/utils/fdt/fdt_fixup.dep CC platform/generic/lib/utils/fdt/fdt_fixup.o lib/utils/fdt/fdt_fixup.c: In function 'fdt_reserved_memory_fixup': lib/utils/fdt/fdt_fixup.c:376:2: error: label at end of compound statement 376 | next_entry: | ^~~~~~~~~~ Remove the goto statement. Resolves: https://github.com/riscv-software-src/opensbi/issues/288 Signed-off-by: Yu Chien Peter Lin Signed-off-by: Xiang W Reviewed-by: Anup Patel Reviewed-by: Bin Meng --- Changes in v4: - Continue to fix the comment in Changes v3 Changes in v3: - Fix a comment issue raised by Bin Meng - Changed the type of "overlap" from int to bool as suggested by Bin Meng Changes in v2: - Fix a comment issue raised by Andreas Schwab lib/utils/fdt/fdt_fixup.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) lib/utils/fdt/fdt_fixup.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index 619e4f5..c10179b 100644 --- a/lib/utils/fdt/fdt_fixup.c +++ b/lib/utils/fdt/fdt_fixup.c @@ -361,19 +361,22 @@ int fdt_reserved_memory_fixup(void *fdt) return SBI_ENOSPC; } + bool overlap = false; addr = reg->base; for (j = 0; j < i; j++) { if (addr == filtered_base[j] && filtered_order[j] < reg->order) { + overlap = true; filtered_order[j] = reg->order; - goto next_entry; + break; } } - filtered_base[i] = reg->base; - filtered_order[i] = reg->order; - i++; - next_entry: + if (!overlap) { + filtered_base[i] = reg->base; + filtered_order[i] = reg->order; + i++; + } } for (j = 0; j < i; j++) {