fix(manifest): ignore memory regions with size 0
This patch modifies check_and_record_mem_regions() to return an error on
regions with size '0' when parsing a secure partition's manifest.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I9d9ee97357440849ec51bd88db5296069abc322e
diff --git a/src/manifest_test.cc b/src/manifest_test.cc
index 04d97cf..e5d03d6 100644
--- a/src/manifest_test.cc
+++ b/src/manifest_test.cc
@@ -1132,6 +1132,38 @@
MANIFEST_ERROR_PROPERTY_NOT_FOUND);
manifest_dealloc();
+ /* Empty memory region */
+ /* clang-format off */
+ dtb = ManifestDtBuilder()
+ .FfaValidManifest()
+ .StartChild("memory-regions")
+ .Compatible({ "arm,ffa-manifest-memory-regions" })
+ .Label("rx")
+ .StartChild("rx")
+ .Description("rx-buffer")
+ .Property("base-address", "<0x7300000>")
+ .Property("pages-count", "<0>")
+ .Property("attributes", "<1>")
+ .EndChild()
+ .Label("tx")
+ .StartChild("tx")
+ .Description("tx-buffer")
+ .Property("base-address", "<0x7310000>")
+ .Property("pages-count", "<2>")
+ .Property("attributes", "<3>")
+ .EndChild()
+ .EndChild()
+ .StartChild("rx_tx-info")
+ .Compatible({ "arm,ffa-manifest-rx_tx-buffer" })
+ .Property("rx-buffer", "<&rx>")
+ .Property("tx-buffer", "<&tx>")
+ .EndChild()
+ .Build();
+ /* clang-format on */
+ ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
+ MANIFEST_ERROR_MEM_REGION_EMPTY);
+ manifest_dealloc();
+
/* Overlapping memory regions */
/* clang-format off */
dtb = ManifestDtBuilder()