[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea1578e5-c7e8-131d-a1d9-3c726afaabfa@users.sourceforge.net>
Date: Sat, 1 Oct 2016 09:43:18 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: dm-devel@...hat.com, linux-raid@...r.kernel.org,
Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...hat.com>, Shaohua Li <shli@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 1/9] md/dm-table: Use kmalloc_array() in realloc_argv()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists