diff mbox

[Xen-devel] libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified

Message ID 1393416780-10912-1-git-send-email-ian.campbell@citrix.com
State Accepted
Commit 3647a486ec05b1e01930ff299b18fc2b632e2cb0
Headers show

Commit Message

Ian Campbell Feb. 26, 2014, 12:13 p.m. UTC
Otherwise we deference a NULL pointer.

I saw this while experimenting with libvirt on Xen on ARM, xl already checks
that the command line is non NULL and provides "" as a default.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: george.dunlap@citrix.com>
---
This is a pretty obvious fix and would be nice to have if we are taking any
more fixes for other stuff , but otherwise I think we can leave to 4.4.1 quite
happily.
---
 tools/libxl/libxl_arm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ian Campbell Feb. 26, 2014, 12:14 p.m. UTC | #1
On Wed, 2014-02-26 at 12:13 +0000, Ian Campbell wrote:
> Otherwise we deference a NULL pointer.
> 
> I saw this while experimenting with libvirt on Xen on ARM, xl already checks
> that the command line is non NULL and provides "" as a default.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: george.dunlap@citrix.com>

Typo (extra ">") so Goerge's CC got missed out...

> ---
> This is a pretty obvious fix and would be nice to have if we are taking any
> more fixes for other stuff , but otherwise I think we can leave to 4.4.1 quite
> happily.
> ---
>  tools/libxl/libxl_arm.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index 0a1c8c5..0cfd0cf 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -164,8 +164,10 @@ static int make_chosen_node(libxl__gc *gc, void *fdt,
>      res = fdt_begin_node(fdt, "chosen");
>      if (res) return res;
>  
> -    res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
> -    if (res) return res;
> +    if (info->u.pv.cmdline) {
> +        res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
> +        if (res) return res;
> +    }
>  
>      res = fdt_end_node(fdt);
>      if (res) return res;
Julien Grall Feb. 28, 2014, 3:18 p.m. UTC | #2
On 26/02/14 20:14, Ian Campbell wrote:
> On Wed, 2014-02-26 at 12:13 +0000, Ian Campbell wrote:
>> Otherwise we deference a NULL pointer.
>>
>> I saw this while experimenting with libvirt on Xen on ARM, xl already checks
>> that the command line is non NULL and provides "" as a default.
>>
>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>> Cc: george.dunlap@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>

>
> Typo (extra ">") so Goerge's CC got missed out...
>
>> ---
>> This is a pretty obvious fix and would be nice to have if we are taking any
>> more fixes for other stuff , but otherwise I think we can leave to 4.4.1 quite
>> happily.
>> ---
>>   tools/libxl/libxl_arm.c |    6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
>> index 0a1c8c5..0cfd0cf 100644
>> --- a/tools/libxl/libxl_arm.c
>> +++ b/tools/libxl/libxl_arm.c
>> @@ -164,8 +164,10 @@ static int make_chosen_node(libxl__gc *gc, void *fdt,
>>       res = fdt_begin_node(fdt, "chosen");
>>       if (res) return res;
>>
>> -    res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
>> -    if (res) return res;
>> +    if (info->u.pv.cmdline) {
>> +        res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
>> +        if (res) return res;
>> +    }
>>
>>       res = fdt_end_node(fdt);
>>       if (res) return res;
>
>
Ian Campbell March 13, 2014, 10:55 a.m. UTC | #3
On Wed, 2014-02-26 at 12:14 +0000, Ian Campbell wrote:
> On Wed, 2014-02-26 at 12:13 +0000, Ian Campbell wrote:
> > Otherwise we deference a NULL pointer.
> > 
> > I saw this while experimenting with libvirt on Xen on ARM, xl already checks
> > that the command line is non NULL and provides "" as a default.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > Cc: george.dunlap@citrix.com>
> 
> Typo (extra ">") so Goerge's CC got missed out...

Dropping George since 4.4 is out the door so I'm sure he doesn't care
any more.

Ping to the rest of you...

> 
> > ---
> > This is a pretty obvious fix and would be nice to have if we are taking any
> > more fixes for other stuff , but otherwise I think we can leave to 4.4.1 quite
> > happily.
> > ---
> >  tools/libxl/libxl_arm.c |    6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> > index 0a1c8c5..0cfd0cf 100644
> > --- a/tools/libxl/libxl_arm.c
> > +++ b/tools/libxl/libxl_arm.c
> > @@ -164,8 +164,10 @@ static int make_chosen_node(libxl__gc *gc, void *fdt,
> >      res = fdt_begin_node(fdt, "chosen");
> >      if (res) return res;
> >  
> > -    res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
> > -    if (res) return res;
> > +    if (info->u.pv.cmdline) {
> > +        res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
> > +        if (res) return res;
> > +    }
> >  
> >      res = fdt_end_node(fdt);
> >      if (res) return res;
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
Ian Campbell March 13, 2014, 12:48 p.m. UTC | #4
On Thu, 2014-03-13 at 10:55 +0000, Ian Campbell wrote:
> On Wed, 2014-02-26 at 12:14 +0000, Ian Campbell wrote:
> > On Wed, 2014-02-26 at 12:13 +0000, Ian Campbell wrote:
> > > Otherwise we deference a NULL pointer.
> > > 
> > > I saw this while experimenting with libvirt on Xen on ARM, xl already checks
> > > that the command line is non NULL and provides "" as a default.
> > > 
> > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > > Cc: george.dunlap@citrix.com>
> > 
> > Typo (extra ">") so Goerge's CC got missed out...
> 
> Dropping George since 4.4 is out the door so I'm sure he doesn't care
> any more.
> 
> Ping to the rest of you...

Nevermind, I misfiled Julien's ack.

Ian.
Ian Campbell March 14, 2014, 3:13 p.m. UTC | #5
On Fri, 2014-02-28 at 23:18 +0800, Julien Grall wrote:
> 
> On 26/02/14 20:14, Ian Campbell wrote:
> > On Wed, 2014-02-26 at 12:13 +0000, Ian Campbell wrote:
> >> Otherwise we deference a NULL pointer.
> >>
> >> I saw this while experimenting with libvirt on Xen on ARM, xl already checks
> >> that the command line is non NULL and provides "" as a default.
> >>
> >> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> >> Cc: george.dunlap@citrix.com>
> Acked-by: Julien Grall <julien.grall@linaro.org>

Thanks, applied.

Ian -- please can you queue for 4.4.1.
Ian Jackson March 14, 2014, 5:33 p.m. UTC | #6
Ian Campbell writes ("Re: [PATCH] libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified"):
> Ian -- please can you queue for 4.4.1.

Queued.

Ian.
Ian Jackson April 4, 2014, 3:11 p.m. UTC | #7
Ian Jackson writes ("Re: [PATCH] libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified"):
> Ian Campbell writes ("Re: [PATCH] libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified"):
> > Ian -- please can you queue for 4.4.1.
> 
> Queued.

Now pushed to staging-4.4.

Thanks.
Ian.
diff mbox

Patch

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 0a1c8c5..0cfd0cf 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -164,8 +164,10 @@  static int make_chosen_node(libxl__gc *gc, void *fdt,
     res = fdt_begin_node(fdt, "chosen");
     if (res) return res;
 
-    res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
-    if (res) return res;
+    if (info->u.pv.cmdline) {
+        res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
+        if (res) return res;
+    }
 
     res = fdt_end_node(fdt);
     if (res) return res;