diff mbox

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

Message ID 1368743651-31492-1-git-send-email-julien.grall@linaro.org
State Accepted, archived
Headers show

Commit Message

Julien Grall May 16, 2013, 10:34 p.m. UTC
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.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/domain_build.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Stabellini May 20, 2013, 10:30 a.m. UTC | #1
On Thu, 16 May 2013, Julien Grall wrote:
> 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.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen/arch/arm/domain_build.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 8369099..b92c64b 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -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];
> -- 
> 1.7.10.4
>
Ian Campbell May 23, 2013, 1:24 p.m. UTC | #2
On Mon, 2013-05-20 at 11:30 +0100, Stefano Stabellini wrote:
> On Thu, 16 May 2013, Julien Grall wrote:
> > 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.
> > 
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Applied, ta.
diff mbox

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 8369099..b92c64b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -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];