Patchwork vmdk: vmdk_read_cid returns garbage if p_name is NULL

login
register
mail settings
Submitter Pavel Borzenkov
Date Oct. 18, 2011, 5:19 p.m.
Message ID <1318958343-14167-1-git-send-email-pavel.borzenkov@gmail.com>
Download mbox | patch
Permalink /patch/120470/
State New
Headers show

Comments

Pavel Borzenkov - Oct. 18, 2011, 5:19 p.m.
Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
---
 block/vmdk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Stefan Hajnoczi - Oct. 20, 2011, 5:22 p.m.
On Tue, Oct 18, 2011 at 09:19:03PM +0400, Pavel Borzenkov wrote:
> Spotted by Clang Analyzer
> 
> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> ---
>  block/vmdk.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan

Patch

diff --git a/block/vmdk.c b/block/vmdk.c
index 3969131..a75dcc2 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -207,7 +207,7 @@  static void vmdk_free_last_extent(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;