Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1496526
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 46/54] md/raid10: Less function calls in setup_conf() after error detection |
| Date | Thu, 06 Oct 2016 11:50:02 +0200 |
| Message-ID | <spdto-6Li-15@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <spcH0-6dt-53@gated-at.bofh.it> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V03:K0:N90ZBfNjualKtecNsTGliJsakUY+4oZuc4aY+TzRshWXoQTZjAV IaaGg6E5VuxH3nuvIiCCtE6ILCCrqZ7QdgZvRFarZtlHTWFI4ebYVudm5E0tGHw7tnjRDn6 H2QkwXhE/VtdRsucnnpYwotk6zs0qcU8bQEq15mviwcUNwWfREDFNwtuZP/EES6rrD1BXfB 6CdkZURaY7SlCvzy4MVhA== |
| X-Ui-Out-Filterresults | notjunk:1;V01:K0:PEViKNDY6qQ=:ZVUM2F3zgSA1MU80Xo5prU 8B+mk5FXEAndZomk/tmK+GOxKT9qdtNWqUmyq08Bd6+gMnGS9gzvHcVCiGjKXzohjpTg//t7r 8hgbOK9ksg5dzF7xMnGU5N1bTdyRCeyW2UphBNhbpjlvFStzpLj15SixNR2DLXBb7QDa6Ll/z +DIV6T+pp/5oKjF/8ivc+OCm9ZsgsLM1cYj2cG8522wbMOxGjvrJB7S3L4oFz7Cojw6V6m6Te FU74oWIhfJZKFDslDaAd8CZOzkUBphfXu+ZXFX0PEgebCqmxq9If+f0TR/EIQI1dkwqBnkz94 n8n4Um/1uqrY+YalSf4QCaWdVOhMoaSUmTmCrQgOGv9uOAjzLXiDCF3s1FZViwxFa4ZlKYo76 rCNwnyKp1bPMll6X7qBKZP13ZnMgKZb3CCL9Sh3MxGvse7D3kZFv0vGsU8AN+nEb15A8Z1dNa 8DRtGfUa4w771tPACGh+Kwmz3gQk/LxMtivDC6U2NKxTktvfDo90kztNKmNYB0/i4G50HNv77 XEGrP4f+uEwyj2nrymK4SgzSpJVyczvHIjEYqKwgxOiNUu3P+X14ompbAlgkgwo2i3OXDL8qW qXkZMrF3KcwxvEvwTl8FYyPp47O/kNdyqLq8X4rDLMJwfAdcKRYHYWjirqqhln4GzEcHsB7el nGR6G5XEV7Agxd5rRMtVqvxvGhjNEZuP5GaMn3iCI2D7xCsqQywRavyf5B7fN6+FAPCtAiSmi tQMB4gIcqbx1TV8dir0t1LVytfadco+WxV55P3Epj47RwR/VgzLeU6BN3z8lbVzUMcxsOwXQF DLppqF1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 76 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr> |
| X-Original-Date | Thu, 6 Oct 2016 11:46:15 +0200 |
| X-Original-Message-ID | <fbf4bcd3-1505-d959-eaa2-f6688a0aec2c@users.sourceforge.net> |
| X-Original-References | <566ABCD9.1060404@users.sourceforge.net> <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1496526 |
Show key headers only | View raw
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 5 Oct 2016 18:32:30 +0200
Resource release functions were called in up to three cases
by the setup_conf() function during error handling even if
the passed data structure members contained a null pointer.
Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/raid10.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7e512d4..9b8d11f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3508,13 +3508,13 @@ static struct r10conf *setup_conf(struct mddev *mddev)
GFP_KERNEL);
if (!conf->mirrors) {
err = -ENOMEM;
- goto out;
+ goto free_conf;
}
conf->tmppage = alloc_page(GFP_KERNEL);
if (!conf->tmppage) {
err = -ENOMEM;
- goto out;
+ goto kfree_mirrors;
}
conf->geo = geo;
@@ -3523,7 +3523,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
r10bio_pool_free, conf);
if (!conf->r10bio_pool) {
err = -ENOMEM;
- goto out;
+ goto put_page;
}
calc_sectors(conf, mddev->dev_sectors);
@@ -3533,7 +3533,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
} else {
if (setup_geo(&conf->prev, mddev, geo_old) != conf->copies) {
err = -EINVAL;
- goto out;
+ goto destroy_pool;
}
conf->reshape_progress = mddev->reshape_position;
if (conf->prev.far_offset)
@@ -3554,16 +3554,18 @@ static struct r10conf *setup_conf(struct mddev *mddev)
conf->thread = md_register_thread(raid10d, mddev, "raid10");
if (!conf->thread) {
err = -ENOMEM;
- goto out;
+ goto destroy_pool;
}
conf->mddev = mddev;
return conf;
-
- out:
+destroy_pool:
mempool_destroy(conf->r10bio_pool);
+put_page:
safe_put_page(conf->tmppage);
+kfree_mirrors:
kfree(conf->mirrors);
+free_conf:
kfree(conf);
return ERR_PTR(err);
}
--
2.10.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
MD-RAID: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
[PATCH 33/54] md/raid5: Replace printk() calls by the usage of higher level interfaces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
[PATCH 34/54] md/raid5: Delete indentation for two jump labels SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
[PATCH 35/54] md/raid5: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
[PATCH 36/54] md/raid5: Delete four unwanted spaces behind function names SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
[PATCH 43/54] md/raid10: Return directly after detection of unsupported settings in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 42/54] md/raid10: Delete an error message for a failed memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 46/54] md/raid10: Less function calls in setup_conf() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 47/54] md/raid10: Improve another size determination in raid10_start_reshape() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 48/54] md/raid10: Move a brace for a designated initialiser SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 41/54] md/raid10: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 45/54] md/raid10: Move assignments for the variable "err" in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 39/54] md/raid5: Add some spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 44/54] md/raid10: Return directly after a failed kzalloc() in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 49/54] md/raid10: Replace printk() calls by the usage of higher level interfaces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
Re: [PATCH 49/54] md/raid10: Replace printk() calls by the usage of higher level interfaces Joe Perches <coupons@perches.com> - 2016-10-06 18:40 +0200
Re: [PATCH 49/54] md/raid10: Replace printk() calls by the usage of higher level interfaces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 19:30 +0200
Re: [PATCH 49/54] md/raid10: Replace printk() calls by the usage of higher level interfaces Joe Perches <joe@perches.com> - 2016-10-06 19:40 +0200
Re: md/raid10: Replace printk() calls by the usage of higher level interfaces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 20:10 +0200
Re: md/raid10: Replace printk() calls by the usage of higher level interfaces Joe Perches <joe@perches.com> - 2016-10-06 20:20 +0200
Re: md/raid10: Replace printk() calls by the usage of higher level interfaces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 20:40 +0200
[PATCH 40/54] md/raid10: Use kcalloc() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:50 +0200
[PATCH 53/54] md/raid10: Delete two unwanted spaces behind asterisks SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 12:00 +0200
[PATCH 52/54] md/raid10: Replace a seq_printf() call by seq_puts() in raid10_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 12:00 +0200
[PATCH 50/54] md/raid10: Delete indentation for one jump label SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 12:00 +0200
[PATCH 54/54] md/raid10: Add some spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 12:00 +0200
[PATCH 51/54] md/raid10: Adjust 22 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 12:00 +0200
csiph-web