[PATCH v2 5/8] lmb: correct size of the regions array

Patrick Delaunay patrick.delaunay at foss.st.com
Wed Mar 10 10:16:29 CET 2021


As in lmb_region, cnt < max and in the lmb library
use region[i] only with i in 0...cnt, this region array size
can be reduced by 1 element without overflow.

This patch allows to reduce the struct lmb size.

Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
---

Changes in v2:
- new in V2: reduce size impact by correct regions array size

 include/lmb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/lmb.h b/include/lmb.h
index d3adf8ef69..898ce15d07 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -20,7 +20,7 @@ struct lmb_property {
 struct lmb_region {
 	unsigned long cnt;
 	unsigned long max;
-	struct lmb_property region[CONFIG_LMB_MAX_REGIONS + 1];
+	struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
 };
 
 struct lmb {
-- 
2.17.1



More information about the U-Boot mailing list