nbd: fix return value in error handling path
Subsystems (2)
PATCH 1/1 nbd: fix return value in error handling path
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 <[email protected]>
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -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); }
Signature · 1 line
2.7.4
Quoted 5 lines · Gustavo A. R. Silva
It seems that the proper value to return in this particular case is the one contained into variable
new_indexinstead of ret.Addresses-Coverity-ID: 1465148 ("Copy-paste error")
Fixes e46c7287b1c2 ("nbd: add a basic netlink interface")
Reviewed-by Omar Sandoval <[email protected]>
Quoted 21 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -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); }Signature · 1 line
2.7.4
Quoted 7 lines · Omar Sandoval
Quoted 5 lines · Gustavo A. R. Silva
It seems that the proper value to return in this particular case is the one contained into variable
new_indexinstead of ret.Addresses-Coverity-ID: 1465148 ("Copy-paste error")
Fixes e46c7287b1c2 ("nbd: add a basic netlink interface")Reviewed-by Omar Sandoval <[email protected]>
Thanks, Omar.
--
Gustavo
Quoted 21 lines
Quoted 21 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -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); }Signature · 1 line
2.7.4
Quoted 2 lines · Gustavo A. R. Silva
It seems that the proper value to return in this particular case is the one contained into variable
new_indexinstead of ret.
Thanks, applied.
Signature · 1 line
Jens Axboe