diff mbox

[v2,1/1] block: fix shadowed variable in bdrv_co_pdiscard

Message ID 20170710150559.30163-1-den@openvz.org (mailing list archive)
State New, archived
Headers show

Commit Message

Denis V. Lunev July 10, 2017, 3:05 p.m. UTC
We've had a shadowed 'ret' variable, which risks returning the wrong
value, introduced in commit b9c64947.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Fam Zheng <famz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
 block/io.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Eric Blake July 10, 2017, 3:32 p.m. UTC | #1
On 07/10/2017 10:05 AM, Denis V. Lunev wrote:
> We've had a shadowed 'ret' variable, which risks returning the wrong
> value, introduced in commit b9c64947.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
>  block/io.c | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/block/io.c b/block/io.c
> index 23170a57ee..87208990c4 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2327,7 +2327,6 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset,
>      assert(max_pdiscard >= bs->bl.request_alignment);
>  
>      while (bytes > 0) {
> -        int ret;
>          int num = bytes;
>  
>          if (head) {
>
Stefan Hajnoczi July 11, 2017, 9:23 a.m. UTC | #2
On Mon, Jul 10, 2017 at 06:05:59PM +0300, Denis V. Lunev wrote:
> We've had a shadowed 'ret' variable, which risks returning the wrong
> value, introduced in commit b9c64947.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
>  block/io.c | 1 -
>  1 file changed, 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan
diff mbox

Patch

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