Patchwork [stable-0.15,08/36] vmdk: vmdk_read_cid returns garbage if p_name is NULL

login
register
mail settings
Submitter Andreas Färber
Date March 28, 2012, 12:52 p.m.
Message ID <1332939159-16434-9-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/149259/
State New
Headers show

Comments

Andreas Färber - March 28, 2012, 12:52 p.m.
From: Pavel Borzenkov <pavel.borzenkov@gmail.com>

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 8379e46d1fd681b8aa4714382e2cdab05e5d0575)

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 block/vmdk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/block/vmdk.c b/block/vmdk.c
index 37478d2..b5caa40 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -177,7 +177,7 @@  static void vmdk_free_extents(BlockDriverState *bs)
 static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
 {
     char desc[DESC_SIZE];
-    uint32_t cid;
+    uint32_t cid = 0xffffffff;
     const char *p_name, *cid_str;
     size_t cid_str_size;
     BDRVVmdkState *s = bs->opaque;