diff mbox

scsi: Don't check uninitialized local variable

Message ID 20180108030946.14991-1-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng Jan. 8, 2018, 3:09 a.m. UTC
After the out label there is a check on iTask.task but it is not
initialized yet.

Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/iscsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paolo Bonzini Jan. 9, 2018, 6:05 p.m. UTC | #1
On 08/01/2018 04:09, Fam Zheng wrote:
> After the out label there is a check on iTask.task but it is not
> initialized yet.
> 
> Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/iscsi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 5c0a9e55b6..1cb8cc93c5 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -659,8 +659,7 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
>      int64_t ret;
>  
>      if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
> -        ret = -EINVAL;
> -        goto out;
> +        return -EINVAL;
>      }
>  
>      /* default to all sectors allocated */
> 

Queued, thanks.

Paolo
Eric Blake Jan. 9, 2018, 6:14 p.m. UTC | #2
On 01/09/2018 12:05 PM, Paolo Bonzini wrote:
> On 08/01/2018 04:09, Fam Zheng wrote:
>> After the out label there is a check on iTask.task but it is not
>> initialized yet.
>>
>> Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
>> Signed-off-by: Fam Zheng <famz@redhat.com>
>> ---
>>  block/iscsi.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/block/iscsi.c b/block/iscsi.c
>> index 5c0a9e55b6..1cb8cc93c5 100644
>> --- a/block/iscsi.c
>> +++ b/block/iscsi.c
>> @@ -659,8 +659,7 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
>>      int64_t ret;
>>  
>>      if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
>> -        ret = -EINVAL;
>> -        goto out;
>> +        return -EINVAL;
>>      }
>>  
>>      /* default to all sectors allocated */
>>
> 
> Queued, thanks.

I thought we wanted Peter's version, not Fam's.
https://lists.gnu.org/archive/html/qemu-devel/2018-01/msg01237.html
diff mbox

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 5c0a9e55b6..1cb8cc93c5 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -659,8 +659,7 @@  static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
     int64_t ret;
 
     if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
-        ret = -EINVAL;
-        goto out;
+        return -EINVAL;
     }
 
     /* default to all sectors allocated */