]> www.infradead.org Git - users/dwmw2/qemu.git/commit
vdi: Fix warning from clang
authorStefan Weil <sw@weilnetz.de>
Fri, 17 Aug 2012 13:23:24 +0000 (15:23 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 12 Oct 2012 02:44:16 +0000 (21:44 -0500)
commit1c224f0ab3ee2807844527126546abece2bdfc4b
tree1b9c4b5e0f58df29e511d83e7d5f825bf681bb93
parent1e32a1651aeb071481b20f873f8d61a0692f7be5
vdi: Fix warning from clang

ccc-analyzer reports these warnings:

block/vdi.c:704:13: warning: Dereference of null pointer
            bmap[i] = VDI_UNALLOCATED;
            ^
block/vdi.c:702:13: warning: Dereference of null pointer
            bmap[i] = i;
            ^

Moving some code into the if block fixes this.
It also avoids calling function write with 0 bytes of data.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 514f21a5d4613e495adc2e2dd48f18091454efb8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/vdi.c