RDMA/ocrdma: Fix memory leak in _ocrdma_alloc_pd()
Subsystems (2)
PATCH 1/3 RDMA/ocrdma: Fix memory leak in _ocrdma_alloc_pd()
From: Roland Dreier <[email protected]>
If ocrdma_get_pd_num() fails, then we need to free the pd struct we allocated.
This was detected by Coverity (CID 1271245).
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6 -1
@@ -375,7 +375,12 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev,if (dev->pd_mgr->pd_prealloc_valid) { status =ocrdma_get_pd_num (dev, pd); -return (status ==0 ) ? pd :ERR_PTR (status); +if (status ==0 ) { +return pd; + }else { +kfree (pd); +return ERR_PTR (status); + } } retry:
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1432966231-12125-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Quoted 7 lines · Roland Dreier
From: Roland Dreier <[email protected]>
If
ocrdma_get_pd_num()fails, then we need to free the pd struct we allocated.This was detected by Coverity (CID 1271245).
Signed-off-by Roland Dreier <[email protected]>
Thanks, series applied.
Quoted 22 lines
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6
-1@@ -375,7 +375,12 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev,if (dev->pd_mgr->pd_prealloc_valid) { status =ocrdma_get_pd_num (dev, pd); -return (status ==0 ) ? pd :ERR_PTR (status); +if (status ==0 ) { +return pd; + }else { +kfree (pd); +return ERR_PTR (status); + } } retry:
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
A message that is not in the archive (sent off-list or not yet received): 1432999586.114391.158.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Devesh Sharma
Acked-byQuoted 32 lines · Doug Ledford
Quoted 7 lines · Roland Dreier
From: Roland Dreier <[email protected]>
If
ocrdma_get_pd_num()fails, then we need to free the pd struct we allocated.This was detected by Coverity (CID 1271245).
Signed-off-by Roland Dreier <[email protected]>Thanks, series applied.
Quoted 21 lines
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6
-1@@ -375,7 +375,12 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev,if (dev->pd_mgr->pd_prealloc_valid) { status =ocrdma_get_pd_num (dev, pd); -return (status ==0 ) ? pd :ERR_PTR (status); +if (status ==0 ) { +return pd; + }else { +kfree (pd); +return ERR_PTR (status); + } }
Quoted 7 lines
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev, · line 386
Quoted 1 line
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +0
-0retry:--
Doug Ledford <[email protected]>GPG KeyID: 0E572FDD
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html