[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e249b68a-eddd-8f1d-1cc8-2e550c79499d@users.sourceforge.net>
Date: Wed, 11 Jan 2017 21:50:22 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-mtd@...ts.infradead.org,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
Brian Norris <computersforpeace@...il.com>,
Cyrille Pitchen <cyrille.pitchen@...el.com>,
David Woodhouse <dwmw2@...radead.org>,
Denys Vlasenko <dvlasenk@...hat.com>,
Marek Vasut <marek.vasut@...il.com>,
Richard Weinberger <richard@....at>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 15/18] mtd-cfi_cmdset_0002: Use kcalloc() in cfi_ppb_unlock()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 11 Jan 2017 19:15:52 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/mtd/chips/cfi_cmdset_0002.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 0c4751eb6efe..81b6fd35be91 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -2649,7 +2649,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
* first check the locking status of all sectors and save
* it for future use.
*/
- sect = kzalloc(MAX_SECTORS * sizeof(struct ppb_lock), GFP_KERNEL);
+ sect = kcalloc(MAX_SECTORS, sizeof(*sect), GFP_KERNEL);
if (!sect)
return -ENOMEM;
--
2.11.0
Powered by blists - more mailing lists