All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>, qemu-devel@nongnu.org
Cc: Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-block@nongnu.org, qemu-stable <qemu-stable@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/1] block: fix possible return code clobbering in bdrv_co_pdiscard
Date: Mon, 10 Jul 2017 08:51:02 -0500	[thread overview]
Message-ID: <bb92a87e-193a-9f61-38c5-ee69fcff2a97@redhat.com> (raw)
In-Reply-To: <20170710083553.6167-1-den@openvz.org>

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

On 07/10/2017 03:35 AM, Denis V. Lunev wrote:
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com> (supporter:Block I/O path)
> CC: Fam Zheng <famz@redhat.com> (supporter:Block I/O path)

The commit message is a bit sparse; I might have written:

block: fix shadowed variable in bdrv_co_pdiscard

We've had a shadowed 'ret' variable, which risks returning the wrong
value, introduced in commit b9c64947.

> ---
>  block/io.c | 1 -
>  1 file changed, 1 deletion(-)

Adding qemu-stable in cc, and you can add:
Reviewed-by: Eric Blake <eblake@redhat.com>

[and I wonder why gcc doesn't flag the shadowed variable for me - I
definitely touched that code in commit 9f1963b3, but didn't notice that
I kept the shadowing in place.  I guess we don't have that compiler
warning flag turned on for default configuration]

> 
> diff --git a/block/io.c b/block/io.c
> index ed31810c0a..e5c6dc77d3 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2464,7 +2464,6 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset,
>      assert(max_pdiscard >= bs->bl.request_alignment);
>  
>      while (count > 0) {
> -        int ret;
>          int num = count;
>  
>          if (head) {
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2017-07-10 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10  8:35 [Qemu-devel] [PATCH 1/1] block: fix possible return code clobbering in bdrv_co_pdiscard Denis V. Lunev
2017-07-10  8:56 ` Fam Zheng
2017-07-10  8:59   ` Denis V. Lunev
2017-07-10 13:51 ` Eric Blake [this message]
2017-07-10 14:31   ` Denis V. Lunev
2017-07-10 13:59 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2017-07-10 14:31   ` Denis V. Lunev

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=bb92a87e-193a-9f61-38c5-ee69fcff2a97@redhat.com \
    --to=eblake@redhat.com \
    --cc=den@openvz.org \
    --cc=famz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.