Skip to contentSkip to conversation

xen/arm: Remove leading +1 when hypervisor compat property is created

PATCH Applied Julien Grall 3 participants 3 messages May 16, 2013 – May 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Remove leading +1 when hypervisor compat property is created

When a static array with string is created, the size of this array contains the \0.

This error was raised with gcc 4.7 because, the local variables are not always initialized to 0.

---
 xen/arch/arm/domain_build.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index 8369099..b92c64b 100644
@@ -279,7 +279,7 @@ static void make_hypervisor_node(void *fdt, int addrcells, int sizecells)
     fdt_begin_node(fdt, "hypervisor");
 
     /* Cannot use fdt_property_string due to embedded nulls */
-    fdt_property(fdt, "compatible", compat, sizeof(compat) + 1);
+    fdt_property(fdt, "compatible", compat, sizeof(compat));
 
     /* reg 0 is grant table space */
     cell = &reg[0];
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Julien Grall

When a static array with string is created, the size of this array contains the \0.

This error was raised with gcc 4.7 because, the local variables are not always initialized to 0.

Quoted 19 lines
 xen/arch/arm/domain_build.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index 8369099..b92c64b 100644
@@ -279,7 +279,7 @@ static void make_hypervisor_node(void *fdt, int addrcells, int sizecells)
     fdt_begin_node(fdt, "hypervisor");
 
     /* Cannot use fdt_property_string due to embedded nulls */
-    fdt_property(fdt, "compatible", compat, sizeof(compat) + 1);
+    fdt_property(fdt, "compatible", compat, sizeof(compat));
 
     /* reg 0 is grant table space */
     cell = &reg[0];
Signature · 1 line
1.7.10.4