# HG changeset patch # User Zhigang Wang <zhigang.x.wang@oracle.com> # Date 1328294351 18000 # Node ID 9ae3b2b7b494ab8fbc54aa923101dc48132c6c6e # Parent e2722b24dc0962de37215320b05d1bb7c4c42864 libxl: fix bootloader args setting Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> diff -r e2722b24dc09 -r 9ae3b2b7b494 tools/libxl/libxl_bootloader.c --- a/tools/libxl/libxl_bootloader.c Thu Jan 26 17:43:31 2012 +0000 +++ b/tools/libxl/libxl_bootloader.c Fri Feb 03 13:39:11 2012 -0500 @@ -49,9 +49,11 @@ static char **make_bootloader_args(libxl flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/")); if (info->u.pv.bootloader_args) { - char *p = info->u.pv.bootloader_args[0]; - while (*(p++)) - flexarray_set(args, nr++, p); + char **p = info->u.pv.bootloader_args; + while (*p) { + flexarray_set(args, nr++, *p); + p++; + } } flexarray_set(args, nr++, disk);
# HG changeset patch # User Zhigang Wang <zhigang.x.wang@oracle.com> # Date 1328294351 18000 # Node ID 9ae3b2b7b494ab8fbc54aa923101dc48132c6c6e # Parent e2722b24dc0962de37215320b05d1bb7c4c42864 libxl: fix bootloader args setting Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> diff -r e2722b24dc09 -r 9ae3b2b7b494 tools/libxl/libxl_bootloader.c --- a/tools/libxl/libxl_bootloader.c Thu Jan 26 17:43:31 2012 +0000 +++ b/tools/libxl/libxl_bootloader.c Fri Feb 03 13:39:11 2012 -0500 @@ -49,9 +49,11 @@ static char **make_bootloader_args(libxl flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/")); if (info->u.pv.bootloader_args) { - char *p = info->u.pv.bootloader_args[0]; - while (*(p++)) - flexarray_set(args, nr++, p); + char **p = info->u.pv.bootloader_args; + while (*p) { + flexarray_set(args, nr++, *p); + p++; + } } flexarray_set(args, nr++, disk);
Sorry to send duplicate patches. The first mail took a few hours to show up in this mailing list. So I thought it didn't work. Will wait longer next time ... Zhigang On Fri, Feb 3, 2012 at 1:39 PM, Zhigang Wang <zhigang.x.wang@oracle.com> wrote:> # HG changeset patch > # User Zhigang Wang <zhigang.x.wang@oracle.com> > # Date 1328294351 18000 > # Node ID 9ae3b2b7b494ab8fbc54aa923101dc48132c6c6e > # Parent e2722b24dc0962de37215320b05d1bb7c4c42864 > libxl: fix bootloader args setting > > Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> > > diff -r e2722b24dc09 -r 9ae3b2b7b494 tools/libxl/libxl_bootloader.c > --- a/tools/libxl/libxl_bootloader.c Thu Jan 26 17:43:31 2012 +0000 > +++ b/tools/libxl/libxl_bootloader.c Fri Feb 03 13:39:11 2012 -0500 > @@ -49,9 +49,11 @@ static char **make_bootloader_args(libxl > flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/")); > > if (info->u.pv.bootloader_args) { > - char *p = info->u.pv.bootloader_args[0]; > - while (*(p++)) > - flexarray_set(args, nr++, p); > + char **p = info->u.pv.bootloader_args; > + while (*p) { > + flexarray_set(args, nr++, *p); > + p++; > + } > } > > flexarray_set(args, nr++, disk); > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, 2012-02-03 at 13:39 -0500, Zhigang Wang wrote:> # HG changeset patch > # User Zhigang Wang <zhigang.x.wang@oracle.com> > # Date 1328294351 18000 > # Node ID 9ae3b2b7b494ab8fbc54aa923101dc48132c6c6e > # Parent e2722b24dc0962de37215320b05d1bb7c4c42864 > libxl: fix bootloader args settingThis looks correct but please could you expand your commit message to explain what the actual issue you are fixing is e.g. such that someone reading through the logs in the future can tell that this is a fix they might want for the issue they are seeing Ian.> > Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> > > diff -r e2722b24dc09 -r 9ae3b2b7b494 tools/libxl/libxl_bootloader.c > --- a/tools/libxl/libxl_bootloader.c Thu Jan 26 17:43:31 2012 +0000 > +++ b/tools/libxl/libxl_bootloader.c Fri Feb 03 13:39:11 2012 -0500 > @@ -49,9 +49,11 @@ static char **make_bootloader_args(libxl > flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/")); > > if (info->u.pv.bootloader_args) { > - char *p = info->u.pv.bootloader_args[0]; > - while (*(p++)) > - flexarray_set(args, nr++, p); > + char **p = info->u.pv.bootloader_args; > + while (*p) { > + flexarray_set(args, nr++, *p); > + p++; > + } > } > > flexarray_set(args, nr++, disk); > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel
# HG changeset patch # User Zhigang Wang <zhigang.x.wang@oracle.com> # Date 1328540799 18000 # Node ID 3b98813bea086f1892af8af1cc2acbae725ec2b9 # Parent 3432abcf9380d3840ca38439a304f74a37d155fc libxl: fix bootloader args setting When bootloader_args = [''foo'', ''bar''], then info->u.pv.bootloader_args foo\0 bar\0 \0 Before this patch, ''p++'' points to the next character of ''foo\0'' and never comes to ''bar\0'' (because of the ''\0'' in ''foo\0''), so the args will be: args[0] = ''oo\0'' args[1] = ''o\0'' After this patch, ''p++'' points to the next string of pv.bootloader_args, so we get the correct args: args[0] = ''foo\0'' args[1] = ''bar\0'' Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Ian Jackson
2012-Feb-09 18:41 UTC
Re: [PATCH] libxl: fix bootloader args setting [and 1 more messages]
Zhigang Wang writes ("[Xen-devel] [PATCH] libxl: fix bootloader args setting"):> libxl: fix bootloader args settingZhigang Wang writes ("[Xen-devel] [PATCH] libxl: fix bootloader args setting"): ...> libxl: fix bootloader args settingAcked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> Thanks, Ian.