linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
@ 2016-01-12 11:03 Hariprasad Shenai
       [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Hariprasad Shenai @ 2016-01-12 11:03 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	leedom-ut6Up61K2wZBDgjK7y7TUQ, nirranjan-ut6Up61K2wZBDgjK7y7TUQ,
	Hariprasad Shenai

Hi,

This series fixes static checker warning's and fixes GW-Basic name labels
to meaningful ones.

This patch series has been created against Doug's linux tree and includes
patches on iw_cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.

Thanks

V3: Add the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and
    the one line summary for Patch 1/2

V2: Dropped an error message in Patch 1/2 ("iw_cxgb4: Fixes static checker
    warning in c4iw_rdev_open()"), and updated commit message to be
    consistent. Based on review comments by Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org

Hariprasad Shenai (2):
  iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
  iw_cxgb4: Fixes GW-Basic labels to meaningful error names

 drivers/infiniband/hw/cxgb4/device.c | 53 ++++++++++++++----------------------
 1 file changed, 21 insertions(+), 32 deletions(-)

-- 
2.3.4

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

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

* [PATCHv3 for-4.5 1/2] iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
       [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
@ 2016-01-12 11:03   ` Hariprasad Shenai
  2016-01-12 11:03   ` [PATCHv3 for-4.5 2/2] iw_cxgb4: Fixes GW-Basic labels to meaningful error names Hariprasad Shenai
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Shenai @ 2016-01-12 11:03 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	leedom-ut6Up61K2wZBDgjK7y7TUQ, nirranjan-ut6Up61K2wZBDgjK7y7TUQ,
	Hariprasad Shenai

Commit c5dfb000b904 ("iw_cxgb4: Pass qid range to user space driver")
from Dec 11, 2015, leads to the following static checker warning:

	drivers/infiniband/hw/cxgb4/device.c:857 c4iw_rdev_open()
        warn: variable dereferenced before check 'rdev->status_page'

Also we weren't deallocating ocqp pool in error path when failed to
allocate status page. Fixing it too.

Fixes: c5dfb000b904 ("iw_cxgb4: Pass qid range to user space driver")
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Hariprasad Shenai <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index bf155386a71e..2a3490fab914 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -850,14 +850,12 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 	}
 	rdev->status_page = (struct t4_dev_status_page *)
 			    __get_free_page(GFP_KERNEL);
+	if (!rdev->status_page)
+		goto destroy_ocqp_pool;
 	rdev->status_page->qp_start = rdev->lldi.vr->qp.start;
 	rdev->status_page->qp_size = rdev->lldi.vr->qp.size;
 	rdev->status_page->cq_start = rdev->lldi.vr->cq.start;
 	rdev->status_page->cq_size = rdev->lldi.vr->cq.size;
-	if (!rdev->status_page) {
-		pr_err(MOD "error allocating status page\n");
-		goto err4;
-	}
 
 	if (c4iw_wr_log) {
 		rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) *
@@ -873,6 +871,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 	rdev->status_page->db_off = 0;
 
 	return 0;
+destroy_ocqp_pool:
+	c4iw_ocqp_pool_destroy(rdev);
 err4:
 	c4iw_rqtpool_destroy(rdev);
 err3:
-- 
2.3.4

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

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

* [PATCHv3 for-4.5 2/2] iw_cxgb4: Fixes GW-Basic labels to meaningful error names
       [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  2016-01-12 11:03   ` [PATCHv3 for-4.5 1/2] iw_cxgb4: Fixes static checker warning in c4iw_rdev_open() Hariprasad Shenai
@ 2016-01-12 11:03   ` Hariprasad Shenai
  2016-01-12 12:16   ` [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings Leon Romanovsky
  2016-01-13 14:42   ` Steve Wise
  3 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Shenai @ 2016-01-12 11:03 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	leedom-ut6Up61K2wZBDgjK7y7TUQ, nirranjan-ut6Up61K2wZBDgjK7y7TUQ,
	Hariprasad Shenai

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Hariprasad Shenai <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/device.c | 45 ++++++++++++++----------------------
 1 file changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 2a3490fab914..8024ea4417b8 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -315,14 +315,12 @@ static int qp_release(struct inode *inode, struct file *file)
 static int qp_open(struct inode *inode, struct file *file)
 {
 	struct c4iw_debugfs_data *qpd;
-	int ret = 0;
 	int count = 1;
 
 	qpd = kmalloc(sizeof *qpd, GFP_KERNEL);
-	if (!qpd) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!qpd)
+		return -ENOMEM;
+
 	qpd->devp = inode->i_private;
 	qpd->pos = 0;
 
@@ -333,8 +331,8 @@ static int qp_open(struct inode *inode, struct file *file)
 	qpd->bufsize = count * 128;
 	qpd->buf = vmalloc(qpd->bufsize);
 	if (!qpd->buf) {
-		ret = -ENOMEM;
-		goto err1;
+		kfree(qpd);
+		return -ENOMEM;
 	}
 
 	spin_lock_irq(&qpd->devp->lock);
@@ -343,11 +341,7 @@ static int qp_open(struct inode *inode, struct file *file)
 
 	qpd->buf[qpd->pos++] = 0;
 	file->private_data = qpd;
-	goto out;
-err1:
-	kfree(qpd);
-out:
-	return ret;
+	return 0;
 }
 
 static const struct file_operations qp_debugfs_fops = {
@@ -781,8 +775,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 		pr_err(MOD "%s: unsupported udb/ucq densities %u/%u\n",
 		       pci_name(rdev->lldi.pdev), rdev->lldi.udb_density,
 		       rdev->lldi.ucq_density);
-		err = -EINVAL;
-		goto err1;
+		return -EINVAL;
 	}
 	if (rdev->lldi.vr->qp.start != rdev->lldi.vr->cq.start ||
 	    rdev->lldi.vr->qp.size != rdev->lldi.vr->cq.size) {
@@ -791,8 +784,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 		       pci_name(rdev->lldi.pdev), rdev->lldi.vr->qp.start,
 		       rdev->lldi.vr->qp.size, rdev->lldi.vr->cq.size,
 		       rdev->lldi.vr->cq.size);
-		err = -EINVAL;
-		goto err1;
+		return -EINVAL;
 	}
 
 	rdev->qpmask = rdev->lldi.udb_density - 1;
@@ -816,10 +808,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 	     rdev->lldi.db_reg, rdev->lldi.gts_reg,
 	     rdev->qpmask, rdev->cqmask);
 
-	if (c4iw_num_stags(rdev) == 0) {
-		err = -EINVAL;
-		goto err1;
-	}
+	if (c4iw_num_stags(rdev) == 0)
+		return -EINVAL;
 
 	rdev->stats.pd.total = T4_MAX_NUM_PD;
 	rdev->stats.stag.total = rdev->lldi.vr->stag.size;
@@ -831,22 +821,22 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 	err = c4iw_init_resource(rdev, c4iw_num_stags(rdev), T4_MAX_NUM_PD);
 	if (err) {
 		printk(KERN_ERR MOD "error %d initializing resources\n", err);
-		goto err1;
+		return err;
 	}
 	err = c4iw_pblpool_create(rdev);
 	if (err) {
 		printk(KERN_ERR MOD "error %d initializing pbl pool\n", err);
-		goto err2;
+		goto destroy_resource;
 	}
 	err = c4iw_rqtpool_create(rdev);
 	if (err) {
 		printk(KERN_ERR MOD "error %d initializing rqt pool\n", err);
-		goto err3;
+		goto destroy_pblpool;
 	}
 	err = c4iw_ocqp_pool_create(rdev);
 	if (err) {
 		printk(KERN_ERR MOD "error %d initializing ocqp pool\n", err);
-		goto err4;
+		goto destroy_rqtpool;
 	}
 	rdev->status_page = (struct t4_dev_status_page *)
 			    __get_free_page(GFP_KERNEL);
@@ -873,13 +863,12 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 	return 0;
 destroy_ocqp_pool:
 	c4iw_ocqp_pool_destroy(rdev);
-err4:
+destroy_rqtpool:
 	c4iw_rqtpool_destroy(rdev);
-err3:
+destroy_pblpool:
 	c4iw_pblpool_destroy(rdev);
-err2:
+destroy_resource:
 	c4iw_destroy_resource(&rdev->resource);
-err1:
 	return err;
 }
 
-- 
2.3.4

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

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

* Re: [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
       [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  2016-01-12 11:03   ` [PATCHv3 for-4.5 1/2] iw_cxgb4: Fixes static checker warning in c4iw_rdev_open() Hariprasad Shenai
  2016-01-12 11:03   ` [PATCHv3 for-4.5 2/2] iw_cxgb4: Fixes GW-Basic labels to meaningful error names Hariprasad Shenai
@ 2016-01-12 12:16   ` Leon Romanovsky
  2016-01-13 14:42   ` Steve Wise
  3 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2016-01-12 12:16 UTC (permalink / raw)
  To: Hariprasad Shenai
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	leedom-ut6Up61K2wZBDgjK7y7TUQ, nirranjan-ut6Up61K2wZBDgjK7y7TUQ

On Tue, Jan 12, 2016 at 04:33:20PM +0530, Hariprasad Shenai wrote:
> Hi,
> 
> This series fixes static checker warning's and fixes GW-Basic name labels
> to meaningful ones.
> 
> This patch series has been created against Doug's linux tree and includes
> patches on iw_cxgb4 driver.
> 
> We have included all the maintainers of respective drivers. Kindly review
> the change and let us know in case of any review comments.
> 
> Thanks
> 
> V3: Add the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and
>     the one line summary for Patch 1/2

Thank you for investing your time to address all my comments,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

> 
> V2: Dropped an error message in Patch 1/2 ("iw_cxgb4: Fixes static checker
>     warning in c4iw_rdev_open()"), and updated commit message to be
>     consistent. Based on review comments by Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org
> 
> Hariprasad Shenai (2):
>   iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
>   iw_cxgb4: Fixes GW-Basic labels to meaningful error names
> 
>  drivers/infiniband/hw/cxgb4/device.c | 53 ++++++++++++++----------------------
>  1 file changed, 21 insertions(+), 32 deletions(-)
> 
> -- 
> 2.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
       [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-01-12 12:16   ` [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings Leon Romanovsky
@ 2016-01-13 14:42   ` Steve Wise
  2016-01-19 20:53     ` Doug Ledford
  3 siblings, 1 reply; 6+ messages in thread
From: Steve Wise @ 2016-01-13 14:42 UTC (permalink / raw)
  To: 'Hariprasad Shenai', linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, leedom-ut6Up61K2wZBDgjK7y7TUQ,
	nirranjan-ut6Up61K2wZBDgjK7y7TUQ

> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Hariprasad Shenai
> Sent: Tuesday, January 12, 2016 5:03 AM
> To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org; leedom-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org; nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org; Hariprasad Shenai
> Subject: [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
> 
> Hi,
> 
> This series fixes static checker warning's and fixes GW-Basic name labels
> to meaningful ones.
> 
> This patch series has been created against Doug's linux tree and includes
> patches on iw_cxgb4 driver.
> 
> We have included all the maintainers of respective drivers. Kindly review
> the change and let us know in case of any review comments.
> 
> Thanks
> 
> V3: Add the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and
>     the one line summary for Patch 1/2
> 
> V2: Dropped an error message in Patch 1/2 ("iw_cxgb4: Fixes static checker
>     warning in c4iw_rdev_open()"), and updated commit message to be
>     consistent. Based on review comments by Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org
> 
> Hariprasad Shenai (2):
>   iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
>   iw_cxgb4: Fixes GW-Basic labels to meaningful error names
> 
>  drivers/infiniband/hw/cxgb4/device.c | 53 ++++++++++++++----------------------
>  1 file changed, 21 insertions(+), 32 deletions(-)
> 
> --
> 2.3.4
> 


Series looks ok.

Acked-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



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

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

* Re: [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
  2016-01-13 14:42   ` Steve Wise
@ 2016-01-19 20:53     ` Doug Ledford
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2016-01-19 20:53 UTC (permalink / raw)
  To: Steve Wise, 'Hariprasad Shenai',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: leedom-ut6Up61K2wZBDgjK7y7TUQ, nirranjan-ut6Up61K2wZBDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]

On 01/13/2016 09:42 AM, Steve Wise wrote:
>> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-owner@vger.kernel.org] On Behalf Of Hariprasad Shenai
>> Sent: Tuesday, January 12, 2016 5:03 AM
>> To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org; leedom@chelsio.com; nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org; Hariprasad Shenai
>> Subject: [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings
>>
>> Hi,
>>
>> This series fixes static checker warning's and fixes GW-Basic name labels
>> to meaningful ones.
>>
>> This patch series has been created against Doug's linux tree and includes
>> patches on iw_cxgb4 driver.
>>
>> We have included all the maintainers of respective drivers. Kindly review
>> the change and let us know in case of any review comments.
>>
>> Thanks
>>
>> V3: Add the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and
>>     the one line summary for Patch 1/2
>>
>> V2: Dropped an error message in Patch 1/2 ("iw_cxgb4: Fixes static checker
>>     warning in c4iw_rdev_open()"), and updated commit message to be
>>     consistent. Based on review comments by Leon Romanovsky <leon@leon.nu
>>
>> Hariprasad Shenai (2):
>>   iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
>>   iw_cxgb4: Fixes GW-Basic labels to meaningful error names
>>
>>  drivers/infiniband/hw/cxgb4/device.c | 53 ++++++++++++++----------------------
>>  1 file changed, 21 insertions(+), 32 deletions(-)
>>
>> --
>> 2.3.4
>>
> 
> 
> Series looks ok.
> 
> Acked-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
> 
> 
> 


Series applied, thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2016-01-19 20:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 11:03 [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings Hariprasad Shenai
     [not found] ` <1452596602-9952-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2016-01-12 11:03   ` [PATCHv3 for-4.5 1/2] iw_cxgb4: Fixes static checker warning in c4iw_rdev_open() Hariprasad Shenai
2016-01-12 11:03   ` [PATCHv3 for-4.5 2/2] iw_cxgb4: Fixes GW-Basic labels to meaningful error names Hariprasad Shenai
2016-01-12 12:16   ` [PATCHv3 for-4.5 0/2] iw_cxgb4: Fixes static checker warnings Leon Romanovsky
2016-01-13 14:42   ` Steve Wise
2016-01-19 20:53     ` Doug Ledford

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).