usnic: correctly handle kzalloc return value
Subsystems (2)
PATCH 1/1 usnic: correctly handle kzalloc return value
Since kzalloc returns memory address, not error code, it should be checked whether it is null or not.
Signed-off-by Insu Yun <[email protected]>
--- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +4 -4
@@ -221,8 +221,8 @@ create_roce_custom_flow(struct usnic_ib_qp_grp *qp_grp,/* Create Flow Handle */ qp_flow =kzalloc (sizeof (*qp_flow),GFP_ATOMIC ); -if (IS_ERR_OR_NULL (qp_flow)) { - err = qp_flow ?PTR_ERR (qp_flow) : -ENOMEM ; +if (!qp_flow) { + err = -ENOMEM ; goto out_dealloc_flow; } qp_flow->flow = flow;
@@ -296,8 +296,8 @@ create_udp_flow(struct usnic_ib_qp_grp *qp_grp,/* Create qp_flow */ qp_flow =kzalloc (sizeof (*qp_flow),GFP_ATOMIC ); -if (IS_ERR_OR_NULL (qp_flow)) { - err = qp_flow ?PTR_ERR (qp_flow) : -ENOMEM ; +if (!qp_flow) { + err = -ENOMEM ; goto out_dealloc_flow; } qp_flow->flow = flow;
Signature · 6 lines
1.9.1 -- 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): 1445273830-25909-1-git-send-email-wuninsu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Dave Goodell
Reviewed-byQuoted 7 lines · Insu Yun
Since kzalloc returns memory address, not error code, it should be checked whether it is null or not.
Signed-off-by Insu Yun <[email protected]>--- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
This is an updated version of
https://patchwork.kernel.org/patch/7423111/, which also had my:
Reviewed-by Dave Goodell <[email protected]>
-Dave
--
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