lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <0bcea3cf-91e3-01d5-8d80-34cd6b611fb1@users.sourceforge.net>
Date:   Thu, 26 Oct 2017 18:12:31 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-rdma@...r.kernel.org,
        Dennis Dalessandro <dennis.dalessandro@...el.com>,
        Doug Ledford <dledford@...hat.com>,
        Hal Rosenstock <hal.rosenstock@...il.com>,
        Leon Romanovsky <leon@...nel.org>,
        Sean Hefty <sean.hefty@...el.com>,
        Yishai Hadas <yishaih@...lanox.com>,
        Yuval Shaia <yuval.shaia@...cle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] IB/mlx4: Use common error handling code in
 __mlx4_ib_create_flow()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 26 Oct 2017 17:54:15 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/infiniband/hw/mlx4/main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index c636842c5be0..4a598c48ea1c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1691,8 +1691,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
 				mdev, qp, default_table + default_flow,
 				mailbox->buf + size);
 		if (ret < 0) {
-			mlx4_free_cmd_mailbox(mdev->dev, mailbox);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto free_mailbox;
 		}
 		size += ret;
 	}
@@ -1700,8 +1700,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
 		ret = parse_flow_attr(mdev->dev, qp->qp_num, ib_flow,
 				      mailbox->buf + size);
 		if (ret < 0) {
-			mlx4_free_cmd_mailbox(mdev->dev, mailbox);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto free_mailbox;
 		}
 		ib_flow += ((union ib_flow_spec *) ib_flow)->size;
 		size += ret;
@@ -1726,7 +1726,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
 		pr_err("Device managed flow steering is disabled. Fail to register network rule.\n");
 	else if (ret)
 		pr_err("Invalid argument. Fail to register network rule.\n");
-
+free_mailbox:
 	mlx4_free_cmd_mailbox(mdev->dev, mailbox);
 	return ret;
 }
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ