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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b1883b8-790c-156b-6e8d-f2bcf8848903@users.sourceforge.net>
Date:   Mon, 12 Sep 2016 20:57:10 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     ceph-devel@...r.kernel.org, Alex Elder <elder@...nel.org>,
        Ilya Dryomov <idryomov@...il.com>, Sage Weil <sage@...hat.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 12/47] block-rbd: One function call less in
 rbd_dev_v2_parent_info() after error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 12 Sep 2016 18:05:00 +0200

The kfree() function was called in one case by the rbd_dev_v2_parent_info()
function during error handling even if the passed variable "reply_buf"
contained a null pointer.

Adjust jump targets according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/block/rbd.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 90797aa..946e3ca 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5105,7 +5105,7 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 	reply_buf = kmalloc(size, GFP_KERNEL);
 	if (!reply_buf) {
 		ret = -ENOMEM;
-		goto out_err;
+		goto put_spec;
 	}
 
 	snapid = cpu_to_le64(rbd_dev->spec->snap_id);
@@ -5115,12 +5115,12 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 				reply_buf, size);
 	dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
 	if (ret < 0)
-		goto out_err;
+		goto free_buffer;
 
 	p = reply_buf;
 	end = reply_buf + ret;
 	ret = -ERANGE;
-	ceph_decode_64_safe(&p, end, pool_id, out_err);
+	ceph_decode_64_safe(&p, end, pool_id, free_buffer);
 	if (pool_id == CEPH_NOPOOL) {
 		/*
 		 * Either the parent never existed, or we have
@@ -5138,7 +5138,7 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 				rbd_dev->disk->disk_name);
 		}
 
-		goto out;	/* No parent?  No problem. */
+		goto success_indication;	/* No parent?  No problem. */
 	}
 
 	/* The ceph file layout needs to fit pool id in 32 bits */
@@ -5147,16 +5147,16 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 	if (pool_id > (u64)U32_MAX) {
 		rbd_warn(NULL, "parent pool id too large (%llu > %u)",
 			(unsigned long long)pool_id, U32_MAX);
-		goto out_err;
+		goto free_buffer;
 	}
 
 	image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL);
 	if (IS_ERR(image_id)) {
 		ret = PTR_ERR(image_id);
-		goto out_err;
+		goto free_buffer;
 	}
-	ceph_decode_64_safe(&p, end, snap_id, out_err);
-	ceph_decode_64_safe(&p, end, overlap, out_err);
+	ceph_decode_64_safe(&p, end, snap_id, free_buffer);
+	ceph_decode_64_safe(&p, end, overlap, free_buffer);
 
 	/*
 	 * The parent won't change (except when the clone is
@@ -5189,11 +5189,11 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 		}
 	}
 	rbd_dev->parent_overlap = overlap;
-
-out:
+ success_indication:
 	ret = 0;
-out_err:
+ free_buffer:
 	kfree(reply_buf);
+ put_spec:
 	rbd_spec_put(parent_spec);
 
 	return ret;
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ