mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[ Cross-ported to blktap1 from345e44a85d"blktap2: Fix two 'maybe uninitialized' variables" -iwj; Remainder of commit message is from blktap2's version. ] for which gcc 4.9.0 complains about, like this: block-qcow.c: In function `get_cluster_offset': block-qcow.c:431:3: error: `tmp_ptr' may be used uninitialized in this function [-Werror=maybe-uninitialized] memcpy(tmp_ptr, l1_ptr, 4096); ^ block-qcow.c:606:7: error: `tmp_ptr2' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (write(s->fd, tmp_ptr2, 4096) != 4096) { ^ cc1: all warnings being treated as errors /home/dario/Sources/xen/xen/xen.git/tools/blktap2/drivers/../../../tools/Rules.mk:89: recipe for target 'block-qcow.o' failed make[5]: *** [block-qcow.o] Error 1 The proper behavior is to return upon allocation failure. About what to return, 0 seems the best option, looking at both the function and the call sites. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Backport-requested-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> (cherry picked from commit845e8c1653) (cherry picked from commite003d429d8)