Skip to contentSkip to conversation

spapr: initialize local Error pointer

PATCH Applied Greg Kurz 3 participants 4 messages Feb 18, 2016 – Feb 19, 2016

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

PATCH 1/1 spapr: initialize local Error pointer

This fixes a crash in the target QEMU during migration.

Fixes c5f54f3e31bf693f70a98d4d73ea5dbe05689857
---
 hw/ppc/spapr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
index e214a34257b3..c119f5582429 100644
@@ -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);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Greg Kurz

This fixes a crash in the target QEMU during migration.

Fixes c5f54f3e31bf693f70a98d4d73ea5dbe05689857

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

Quoted 10 lines
---
 hw/ppc/spapr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +0 -0
index e214a34257b3..c119f5582429 100644

hw/ppc/spapr.c static int htab_load(QEMUFile *f, void *opaque, int version_id) · line 1534

Quoted 8 lines
hw/ppc/spapr.c +1 -1
@@ -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.

author
#2 lore raw
Quoted 8 lines · On Thu, 18 Feb 2016 16:02:53 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 3 lines · Greg Kurz

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 !

Quoted 24 lines
Quoted 10 lines
---
 hw/ppc/spapr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +0 -0
index e214a34257b3..c119f5582429 100644

hw/ppc/spapr.c static int htab_load(QEMUFile *f, void *opaque, int version_id) · line 1534

Quoted 8 lines
hw/ppc/spapr.c +1 -1
@@ -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.

Applied
#3 lore raw
In reply to Markus Armbruster
Quoted 24 lines · Markus Armbruster
Quoted 3 lines · Greg Kurz

This fixes a crash in the target QEMU during migration.

Fixes c5f54f3e31bf693f70a98d4d73ea5dbe05689857

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

Quoted 16 lines
---
 hw/ppc/spapr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
index e214a34257b3..c119f5582429 100644
@@ -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;
 
Quoted 7 lines

hw/ppc/spapr.c static int htab_load(QEMUFile *f, void *opaque, int version_id) · line 1534

Quoted 2 lines
hw/ppc/spapr.c +0 -0
         /* 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.

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

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson