public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/usnic: check for allocation failure
@ 2017-08-25  8:43 Dan Carpenter
  2017-08-27  8:32 ` Yuval Shaia
  2017-08-28 23:16 ` Doug Ledford
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-08-25  8:43 UTC (permalink / raw)
  To: Christian Benvenuti, Upinder Malhi
  Cc: Dave Goodell, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

usnic_uiom_get_dev_list() can return ERR_PTR(-ENOMEM) so we should check
for that.

Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index e5f57dd49980..e8523882e33b 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -164,6 +164,8 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
 	if (usnic_ib_share_vf) {
 		/* Try to find resouces on a used vf which is in pd */
 		dev_list = usnic_uiom_get_dev_list(pd->umem_pd);
+		if (IS_ERR(dev_list))
+			return ERR_CAST(dev_list);
 		for (i = 0; dev_list[i]; i++) {
 			dev = dev_list[i];
 			vf = pci_get_drvdata(to_pci_dev(dev));
--
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] 3+ messages in thread

* Re: [PATCH] IB/usnic: check for allocation failure
  2017-08-25  8:43 [PATCH] IB/usnic: check for allocation failure Dan Carpenter
@ 2017-08-27  8:32 ` Yuval Shaia
  2017-08-28 23:16 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Yuval Shaia @ 2017-08-27  8:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christian Benvenuti, Upinder Malhi, Dave Goodell, Doug Ledford,
	Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

On Fri, Aug 25, 2017 at 11:43:59AM +0300, Dan Carpenter wrote:
> usnic_uiom_get_dev_list() can return ERR_PTR(-ENOMEM) so we should check
> for that.
> 
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> index e5f57dd49980..e8523882e33b 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> @@ -164,6 +164,8 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
>  	if (usnic_ib_share_vf) {
>  		/* Try to find resouces on a used vf which is in pd */
>  		dev_list = usnic_uiom_get_dev_list(pd->umem_pd);
> +		if (IS_ERR(dev_list))
> +			return ERR_CAST(dev_list);
>  		for (i = 0; dev_list[i]; i++) {
>  			dev = dev_list[i];
>  			vf = pci_get_drvdata(to_pci_dev(dev));

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

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

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

* Re: [PATCH] IB/usnic: check for allocation failure
  2017-08-25  8:43 [PATCH] IB/usnic: check for allocation failure Dan Carpenter
  2017-08-27  8:32 ` Yuval Shaia
@ 2017-08-28 23:16 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2017-08-28 23:16 UTC (permalink / raw)
  To: Dan Carpenter, Christian Benvenuti, Upinder Malhi
  Cc: Dave Goodell, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Fri, 2017-08-25 at 11:43 +0300, Dan Carpenter wrote:
> usnic_uiom_get_dev_list() can return ERR_PTR(-ENOMEM) so we should
> check
> for that.
> 
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware
> driver")
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

Thanks, applied.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
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] 3+ messages in thread

end of thread, other threads:[~2017-08-28 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25  8:43 [PATCH] IB/usnic: check for allocation failure Dan Carpenter
2017-08-27  8:32 ` Yuval Shaia
2017-08-28 23:16 ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox