[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fe4b2fb-c27d-4932-bbcc-23899afa932d@users.sourceforge.net>
Date: Mon, 29 Aug 2016 13:07:37 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linuxppc-dev@...ts.ozlabs.org,
Adam Buchbinder <adam.buchbinder@...il.com>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Marc Zyngier <marc.zyngier@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Paul Mackerras <paulus@...ba.org>,
Scott Wood <scottwood@...escale.com>,
Sudeep Holla <Sudeep.Holla@....com>,
Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: [PATCH 1/5] powerpc-mpic: Use kmalloc_array() in mpic_init()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 29 Aug 2016 11:00:11 +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>
---
arch/powerpc/sysdev/mpic.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 7de45b2..5e79c0d24 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1641,8 +1641,9 @@ void __init mpic_init(struct mpic *mpic)
#ifdef CONFIG_PM
/* allocate memory to save mpic state */
- mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data),
- GFP_KERNEL);
+ mpic->save_data = kmalloc_array(mpic->num_sources,
+ sizeof(*mpic->save_data),
+ GFP_KERNEL);
BUG_ON(mpic->save_data == NULL);
#endif
--
2.9.3
Powered by blists - more mailing lists