* [PATCH] x86/hpet: Use kmalloc_array() in hpet_enable()
@ 2016-09-04 19:45 SF Markus Elfring
0 siblings, 0 replies; only message in thread
From: SF Markus Elfring @ 2016-09-04 19:45 UTC (permalink / raw)
To: x86, Alexandre Belloni, Andy Lutomirski, Arnd Bergmann,
Borislav Petkov, H. Peter Anvin, Ingo Molnar, Jan Beulich,
Sebastian Andrzej Siewior, Thomas Gleixner
Cc: LKML, kernel-janitors, Julia Lawall, Paolo Bonzini
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Sep 2016 21:30:10 +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>
---
arch/x86/kernel/hpet.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index c6dfd80..3c2030d 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -876,8 +876,9 @@ int __init hpet_enable(void)
#endif
cfg = hpet_readl(HPET_CFG);
- hpet_boot_cfg = kmalloc((last + 2) * sizeof(*hpet_boot_cfg),
- GFP_KERNEL);
+ hpet_boot_cfg = kmalloc_array(last + 2,
+ sizeof(*hpet_boot_cfg),
+ GFP_KERNEL);
if (hpet_boot_cfg)
*hpet_boot_cfg = cfg;
else
--
2.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-04 19:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 19:45 [PATCH] x86/hpet: Use kmalloc_array() in hpet_enable() SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome