From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dm-devel@redhat.com, linux-raid@vger.kernel.org,
Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>, Shaohua Li <shli@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 1/9] md/dm-table: Use kmalloc_array() in realloc_argv()
Date: Sat, 1 Oct 2016 09:43:18 +0200 [thread overview]
Message-ID: <ea1578e5-c7e8-131d-a1d9-3c726afaabfa@users.sourceforge.net> (raw)
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 06:47:16 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 3e407a9..f6b817c 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -523,7 +523,7 @@ static char **realloc_argv(unsigned *array_size, char **old_argv)
new_size = 8;
gfp = GFP_NOIO;
}
- argv = kmalloc(new_size * sizeof(*argv), gfp);
+ argv = kmalloc_array(new_size, sizeof(*argv), gfp);
if (argv) {
memcpy(argv, old_argv, *array_size * sizeof(*argv));
*array_size = new_size;
--
2.10.0
next prev parent reply other threads:[~2016-10-01 7:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 7:41 [PATCH 0/9] md/dm-table: Fine-tuning for several function implementations SF Markus Elfring
2016-10-01 7:43 ` SF Markus Elfring [this message]
2016-10-01 7:44 ` [PATCH 2/9] md/dm-table: Reduce the scope for a variable in dm_table_verify_integrity() SF Markus Elfring
2016-10-01 7:45 ` [PATCH 3/9] md/dm-table: Delete an unnecessary variable initialisation in dm_table_register_integrity() SF Markus Elfring
2016-10-01 7:46 ` [PATCH 4/9] md/dm-table: Delete an unnecessary variable initialisation in dm_split_args() SF Markus Elfring
2016-10-01 7:47 ` [PATCH 5/9] md/dm-table: Move an assignment for the variable "end" " SF Markus Elfring
2016-10-01 7:48 ` [PATCH 6/9] md/dm-table: Combine substrings for ten messages SF Markus Elfring
2016-10-01 7:50 ` [PATCH 7/9] md/dm-table: Adjust one function call together with a variable assignment SF Markus Elfring
2016-10-01 7:52 ` [PATCH 8/9] md/dm-table: Delete an unwanted space in high() SF Markus Elfring
2016-10-01 7:53 ` [PATCH 9/9] md/dm-table: Delete an unwanted space in dm_table_get_integrity_disk() SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea1578e5-c7e8-131d-a1d9-3c726afaabfa@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=shli@kernel.org \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).