Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1481850
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 12/47] block-rbd: One function call less in rbd_dev_v2_parent_info() after error detection |
| Date | 2016-09-12 21:00 +0200 |
| Message-ID | <sgECu-7at-57@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <sgEsN-76N-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.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@users.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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/47] RADOS Block Device: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 20:50 +0200
[PATCH 05/47] block-rbd: One function call less in rbd_dev_image_id() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 20:50 +0200
[PATCH 08/47] block-rbd: Rename jump labels in rbd_dev_v2_snap_context() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 09/47] block-rbd: Rename a jump label in rbd_spec_fill_names() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 13/47] block-rbd: Delete an unnecessary initialisation in rbd_dev_v2_parent_info() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 11/47] block-rbd: Delete three unnecessary initialisations in rbd_dev_image_name() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 10/47] block-rbd: One function call less in rbd_dev_image_name() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 14/47] block-rbd: Rename a jump label in rbd_dev_v2_object_prefix() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 12/47] block-rbd: One function call less in rbd_dev_v2_parent_info() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:00 +0200
[PATCH 20/47] block-rbd: Rename a jump label in rbd_register_watch() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 19/47] block-rbd: Rename a jump label in rbd_reregister_watch() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 21/47] block-rbd: Rename jump labels in rbd_try_lock() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 16/47] block-rbd: Rename jump labels in rbd_dev_v1_header_info() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 15/47] block-rbd: Rename jump labels in rbd_dev_create() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
Re: [PATCH 15/47] block-rbd: Rename jump labels in rbd_dev_create() Ilya Dryomov <idryomov@gmail.com> - 2016-09-13 10:10 +0200
[PATCH 17/47] block-rbd: Rename jump labels in rbd_init_disk() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 18/47] block-rbd: Fix jump targets in rbd_queue_workfn() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 22/47] block-rbd: Rename a jump label in find_watcher() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:10 +0200
[PATCH 30/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_callback() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 29/47] block-rbd: Delete an unnecessary initialisation in rbd_img_obj_exists_submit() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 24/47] block-rbd: Rename jump labels in rbd_request_lock() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 23/47] block-rbd: Rename jump labels in get_lock_owner_info() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 26/47] block-rbd: Rename a jump label in rbd_img_parent_read_callback() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 31/47] block-rbd: Fix three jump targets in rbd_img_obj_parent_read_full() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 27/47] block-rbd: Rename a jump label in rbd_img_request_submit() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 25/47] block-rbd: Fix jump targets in rbd_img_parent_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
[PATCH 28/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_submit() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:20 +0200
Re: [PATCH 28/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_submit() Ilya Dryomov <idryomov@gmail.com> - 2016-09-13 10:20 +0200
[PATCH 39/47] block-rbd: Rename a jump label in rbd_ioctl_set_ro() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 35/47] block-rbd: Rename jump labels in rbd_osd_req_create_copyup() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 33/47] block-rbd: Adjust the position of a jump label in rbd_img_request_fill() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 38/47] block-rbd: Rename jump labels in rbd_client_create() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 32/47] block-rbd: Rename a jump label in rbd_img_obj_parent_read_full_callback() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 34/47] block-rbd: Rename a jump label in rbd_img_obj_callback() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 37/47] block-rbd: Rename a jump label in bio_chain_clone_range() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 36/47] block-rbd: Rename jump labels in rbd_osd_req_create() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:30 +0200
[PATCH 47/47] block-rbd: Delete unwanted spaces behind usages of the sizeof operator SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 44/47] block-rbd: Delete an unnecessary initialisation in do_rbd_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 45/47] block-rbd: Rename a jump label in rbd_slab_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 42/47] block-rbd: Rename jump labels in rbd_dev_image_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 40/47] block-rbd: One function call less in rbd_dev_probe_parent() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 46/47] block-rbd: Rename jump labels in rbd_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 41/47] block-rbd: Rename jump labels in rbd_dev_device_setup() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
[PATCH 43/47] block-rbd: Rename jump labels in do_rbd_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-12 21:40 +0200
csiph-web