diff mbox

spapr: initialize local Error pointer

Message ID 20160218144045.7349.67293.stgit@bahia.huguette.org (mailing list archive)
State New, archived
Headers show

Commit Message

Greg Kurz Feb. 18, 2016, 2:40 p.m. UTC
This fixes a crash in the target QEMU during migration.

Fixes: c5f54f3e31bf693f70a98d4d73ea5dbe05689857
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Markus Armbruster Feb. 18, 2016, 3:02 p.m. UTC | #1
Greg Kurz <gkurz@linux.vnet.ibm.com> writes:

> This fixes a crash in the target QEMU during migration.
>
> Fixes: c5f54f3e31bf693f70a98d4d73ea5dbe05689857

Suggest to word that as "Broken in commit c5f54f3."

> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  hw/ppc/spapr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index e214a34257b3..c119f5582429 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1528,7 +1528,7 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
>      section_hdr = qemu_get_be32(f);
>  
>      if (section_hdr) {
> -        Error *local_err;
> +        Error *local_err = NULL;
>  
>          /* First section gives the htab size */
>          spapr_reallocate_hpt(spapr, section_hdr, &local_err);

Easy mistake to make (I've made it myself).  I wish I had the time to
figure out how to make Coccinelle catch it.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Greg Kurz Feb. 18, 2016, 3:10 p.m. UTC | #2
On Thu, 18 Feb 2016 16:02:53 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Greg Kurz <gkurz@linux.vnet.ibm.com> writes:
> 
> > This fixes a crash in the target QEMU during migration.
> >
> > Fixes: c5f54f3e31bf693f70a98d4d73ea5dbe05689857  
> 
> Suggest to word that as "Broken in commit c5f54f3."
> 

This is more explicit indeed. I'll do that for future
patches.

Thanks !

> > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > ---
> >  hw/ppc/spapr.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index e214a34257b3..c119f5582429 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -1528,7 +1528,7 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
> >      section_hdr = qemu_get_be32(f);
> >  
> >      if (section_hdr) {
> > -        Error *local_err;
> > +        Error *local_err = NULL;
> >  
> >          /* First section gives the htab size */
> >          spapr_reallocate_hpt(spapr, section_hdr, &local_err);  
> 
> Easy mistake to make (I've made it myself).  I wish I had the time to
> figure out how to make Coccinelle catch it.
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>
David Gibson Feb. 19, 2016, 12:15 a.m. UTC | #3
On Thu, Feb 18, 2016 at 04:02:53PM +0100, Markus Armbruster wrote:
> Greg Kurz <gkurz@linux.vnet.ibm.com> writes:
> 
> > This fixes a crash in the target QEMU during migration.
> >
> > Fixes: c5f54f3e31bf693f70a98d4d73ea5dbe05689857
> 
> Suggest to word that as "Broken in commit c5f54f3."
> 
> > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > ---
> >  hw/ppc/spapr.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index e214a34257b3..c119f5582429 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -1528,7 +1528,7 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
> >      section_hdr = qemu_get_be32(f);
> >  
> >      if (section_hdr) {
> > -        Error *local_err;
> > +        Error *local_err = NULL;
> >  
> >          /* First section gives the htab size */
> >          spapr_reallocate_hpt(spapr, section_hdr, &local_err);
> 
> Easy mistake to make (I've made it myself).  I wish I had the time to
> figure out how to make Coccinelle catch it.
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Applied to ppc-for-2.6 with Markus's suggested rewording.  Thanks.
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e214a34257b3..c119f5582429 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1528,7 +1528,7 @@  static int htab_load(QEMUFile *f, void *opaque, int version_id)
     section_hdr = qemu_get_be32(f);
 
     if (section_hdr) {
-        Error *local_err;
+        Error *local_err = NULL;
 
         /* First section gives the htab size */
         spapr_reallocate_hpt(spapr, section_hdr, &local_err);