dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0111-qapi-Fix-potential-NULL-pointer-segfault.patch

5544c1
From d01c76a8d9d0d80ba00a407103e7b79112a21fce Mon Sep 17 00:00:00 2001
5544c1
From: Stefan Weil <sw@weilnetz.de>
5544c1
Date: Sat, 1 Sep 2012 09:30:39 +0200
5544c1
Subject: [PATCH] qapi: Fix potential NULL pointer segfault
5544c1
5544c1
Report from smatch:
5544c1
5544c1
qapi-visit.c:1640 visit_type_BlockdevAction(8) error:
5544c1
 we previously assumed 'obj' could be null (see line 1639)
5544c1
qapi-visit.c:2432 visit_type_NetClientOptions(8) error:
5544c1
 we previously assumed 'obj' could be null (see line 2431)
5544c1
5544c1
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
5544c1
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
5544c1
(cherry picked from commit 227ccf6bff234c29974c2c18ecd3a29e6b965e3d)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 scripts/qapi-visit.py | 2 +-
5544c1
 1 file changed, 1 insertion(+), 1 deletion(-)
5544c1
5544c1
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
5544c1
index 04ef7c4..5b15ee3 100644
5544c1
--- a/scripts/qapi-visit.py
5544c1
+++ b/scripts/qapi-visit.py
5544c1
@@ -157,7 +157,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
5544c1
     if (!error_is_set(errp)) {
5544c1
         visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err;;
5544c1
         if (!err) {
5544c1
-            if (!obj || *obj) {
5544c1
+            if (obj && *obj) {
5544c1
                 visit_type_%(name)sKind(m, &(*obj)->kind, "type", &err;;
5544c1
                 if (!err) {
5544c1
                     switch ((*obj)->kind) {
5544c1
-- 
5544c1
1.7.12.1
5544c1