diff mbox

[v1,2/3] IB/srp: Check ib_query_gid return value

Message ID 1393252218-30638-3-git-send-email-sagig@mellanox.com (mailing list archive)
State Rejected
Headers show

Commit Message

Sagi Grimberg Feb. 24, 2014, 2:30 p.m. UTC
Detected by Coverity.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
---
 drivers/infiniband/ulp/srp/ib_srp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Bart Van Assche Feb. 24, 2014, 3:34 p.m. UTC | #1
On 02/24/14 15:30, Sagi Grimberg wrote:
> Detected by Coverity.
> 
> Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 0e20bfb..b615135 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -2652,7 +2652,9 @@ static ssize_t srp_create_target(struct device *dev,
>  	if (ret)
>  		goto err_free_mem;
>  
> -	ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
> +	ret = ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
> +	if (ret)
> +		goto err_free_mem;
>  
>  	shost_printk(KERN_DEBUG, target->scsi_host, PFX
>  		     "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
> 

This patch looks fine to me, so

Acked-by: Bart Van Assche <bvanassche@acm.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 0e20bfb..b615135 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2652,7 +2652,9 @@  static ssize_t srp_create_target(struct device *dev,
 	if (ret)
 		goto err_free_mem;
 
-	ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
+	ret = ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
+	if (ret)
+		goto err_free_mem;
 
 	shost_printk(KERN_DEBUG, target->scsi_host, PFX
 		     "new target: id_ext %016llx ioc_guid %016llx pkey %04x "