linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: fix return value in error handling path
@ 2018-02-12 17:14 Gustavo A. R. Silva
  2018-02-26 23:01 ` Omar Sandoval
  2018-02-27 22:51 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-12 17:14 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-block, nbd, linux-kernel, Gustavo A. R. Silva

It seems that the proper value to return in this particular case is the
one contained into variable new_index instead of ret.

Addresses-Coverity-ID: 1465148 ("Copy-paste error")
Fixes: e46c7287b1c2 ("nbd: add a basic netlink interface")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5f2a424..86258b0 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1591,7 +1591,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
 			if (new_index < 0) {
 				mutex_unlock(&nbd_index_mutex);
 				printk(KERN_ERR "nbd: failed to add new device\n");
-				return ret;
+				return new_index;
 			}
 			nbd = idr_find(&nbd_index_idr, new_index);
 		}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nbd: fix return value in error handling path
  2018-02-12 17:14 [PATCH] nbd: fix return value in error handling path Gustavo A. R. Silva
@ 2018-02-26 23:01 ` Omar Sandoval
  2018-02-27 21:43   ` Gustavo A. R. Silva
  2018-02-27 22:51 ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Omar Sandoval @ 2018-02-26 23:01 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Josef Bacik, linux-block, nbd, linux-kernel, Gustavo A. R. Silva

On Mon, Feb 12, 2018 at 11:14:55AM -0600, Gustavo A. R. Silva wrote:
> It seems that the proper value to return in this particular case is the
> one contained into variable new_index instead of ret.
> 
> Addresses-Coverity-ID: 1465148 ("Copy-paste error")
> Fixes: e46c7287b1c2 ("nbd: add a basic netlink interface")

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/block/nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 5f2a424..86258b0 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1591,7 +1591,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
>  			if (new_index < 0) {
>  				mutex_unlock(&nbd_index_mutex);
>  				printk(KERN_ERR "nbd: failed to add new device\n");
> -				return ret;
> +				return new_index;
>  			}
>  			nbd = idr_find(&nbd_index_idr, new_index);
>  		}
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nbd: fix return value in error handling path
  2018-02-26 23:01 ` Omar Sandoval
@ 2018-02-27 21:43   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-27 21:43 UTC (permalink / raw)
  To: Omar Sandoval, Gustavo A. R. Silva
  Cc: Josef Bacik, linux-block, nbd, linux-kernel



On 02/26/2018 05:01 PM, Omar Sandoval wrote:
> On Mon, Feb 12, 2018 at 11:14:55AM -0600, Gustavo A. R. Silva wrote:
>> It seems that the proper value to return in this particular case is the
>> one contained into variable new_index instead of ret.
>>
>> Addresses-Coverity-ID: 1465148 ("Copy-paste error")
>> Fixes: e46c7287b1c2 ("nbd: add a basic netlink interface")
> Reviewed-by: Omar Sandoval <osandov@fb.com>

Thanks, Omar.
--
Gustavo

>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>   drivers/block/nbd.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> index 5f2a424..86258b0 100644
>> --- a/drivers/block/nbd.c
>> +++ b/drivers/block/nbd.c
>> @@ -1591,7 +1591,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
>>   			if (new_index < 0) {
>>   				mutex_unlock(&nbd_index_mutex);
>>   				printk(KERN_ERR "nbd: failed to add new device\n");
>> -				return ret;
>> +				return new_index;
>>   			}
>>   			nbd = idr_find(&nbd_index_idr, new_index);
>>   		}
>> -- 
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nbd: fix return value in error handling path
  2018-02-12 17:14 [PATCH] nbd: fix return value in error handling path Gustavo A. R. Silva
  2018-02-26 23:01 ` Omar Sandoval
@ 2018-02-27 22:51 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-02-27 22:51 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Josef Bacik
  Cc: linux-block, nbd, linux-kernel, Gustavo A. R. Silva

On 2/12/18 10:14 AM, Gustavo A. R. Silva wrote:
> It seems that the proper value to return in this particular case is the
> one contained into variable new_index instead of ret.

Thanks, applied.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-27 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 17:14 [PATCH] nbd: fix return value in error handling path Gustavo A. R. Silva
2018-02-26 23:01 ` Omar Sandoval
2018-02-27 21:43   ` Gustavo A. R. Silva
2018-02-27 22:51 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).