All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@eu.citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>
Cc: xen-devel@lists.xenproject.org, Keir Fraser <keir@xen.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [blktap2] fix two 'maybe uninitialized' variables
Date: Thu, 12 Jun 2014 10:18:32 +0100	[thread overview]
Message-ID: <1402564712.8162.5.camel@kazak.uk.xensource.com> (raw)
In-Reply-To: <1402488062.16827.90.camel@Solace>

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.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2014-06-12  9:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 12:01 [blktap2] fix two 'maybe uninitialized' variables Dario Faggioli
2014-06-11 12:09 ` Dario Faggioli
2014-06-12  9:18 ` Ian Campbell [this message]
2014-06-12  9:30   ` Dario Faggioli
2014-06-12 11:40     ` Dario Faggioli
2014-06-17 10:07       ` Dario Faggioli
2014-06-18 14:02       ` Ian Campbell
2014-06-20 14:11         ` Dario Faggioli
2014-06-23 17:08           ` Ian Jackson
2014-06-23 17:13           ` Ian Jackson
2014-07-02 15:07             ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402564712.8162.5.camel@kazak.uk.xensource.com \
    --to=ian.campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.