qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter
@ 2010-06-11  8:19 Kevin Wolf
  2010-06-11 13:08 ` [Qemu-devel] " Hao, Xudong
  2010-06-14 16:27 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2010-06-11  8:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, xudong.hao, morita.kazutaka

When dest is NULL, i.e. a new copy of the list is created, we don't get a
properly terminated list after the realloc. Initialize it as an empty list.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---

Xudong, can you please try this one? I think it should fix your qemu-img
problem.

 qemu-option.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/qemu-option.c b/qemu-option.c
index acd74f9..f884865 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,
     num_options += count_option_parameters(list);
 
     dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter));
+    dest[num_dest_options].name = NULL;
 
     while (list && list->name) {
         if (get_option_parameter(dest, list->name) == NULL) {
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] RE: [PATCH] qemu-option: Fix uninitialized value in append_option_parameter
  2010-06-11  8:19 [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter Kevin Wolf
@ 2010-06-11 13:08 ` Hao, Xudong
  2010-06-14 16:27 ` [Qemu-devel] " Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Hao, Xudong @ 2010-06-11 13:08 UTC (permalink / raw)
  To: Kevin Wolf, qemu-devel@nongnu.org; +Cc: morita.kazutaka@lab.ntt.co.jp

Kevin, this patch works fine.

Kevin Wolf wrote:
> When dest is NULL, i.e. a new copy of the list is created, we don't
> get a 
> properly terminated list after the realloc. Initialize it as an empty
> list. 
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> 
> Xudong, can you please try this one? I think it should fix your
> qemu-img 
> problem.
> 
>  qemu-option.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/qemu-option.c b/qemu-option.c
> index acd74f9..f884865 100644
> --- a/qemu-option.c
> +++ b/qemu-option.c
> @@ -378,6 +378,7 @@ QEMUOptionParameter
>      *append_option_parameters(QEMUOptionParameter *dest, num_options
> += count_option_parameters(list); 
> 
>      dest = qemu_realloc(dest, (num_options + 1) *
> sizeof(QEMUOptionParameter)); +    dest[num_dest_options].name = NULL;
> 
>      while (list && list->name) {
>          if (get_option_parameter(dest, list->name) == NULL) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter
  2010-06-11  8:19 [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter Kevin Wolf
  2010-06-11 13:08 ` [Qemu-devel] " Hao, Xudong
@ 2010-06-14 16:27 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-06-14 16:27 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: xudong.hao, qemu-devel, morita.kazutaka

On 06/11/2010 03:19 AM, Kevin Wolf wrote:
> When dest is NULL, i.e. a new copy of the list is created, we don't get a
> properly terminated list after the realloc. Initialize it as an empty list.
>
> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>
> Xudong, can you please try this one? I think it should fix your qemu-img
> problem.
>
>   qemu-option.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-option.c b/qemu-option.c
> index acd74f9..f884865 100644
> --- a/qemu-option.c
> +++ b/qemu-option.c
> @@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,
>       num_options += count_option_parameters(list);
>
>       dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter));
> +    dest[num_dest_options].name = NULL;
>
>       while (list&&  list->name) {
>           if (get_option_parameter(dest, list->name) == NULL) {
>    

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-14 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11  8:19 [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter Kevin Wolf
2010-06-11 13:08 ` [Qemu-devel] " Hao, Xudong
2010-06-14 16:27 ` [Qemu-devel] " Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).