[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [blktap2] fix two 'maybe uninitialized' variables

On Wed, 2014-06-11 at 14:01 +0200, Dario Faggioli wrote:
> 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) {

You initialise both of these to NULL as they are defined, but the
compiler has apparently found a path where these values can be used
without subsequently being initialised, so you are passing NULL to
memcpy/write, which can't be good.

If you've proved that the compiler is wrong/confused and this cannot
happen please explain the how/why it is wrong here.

For the preferred $subject I always just look in the git log for the
appropriate file/directory.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.