Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1471730
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/5] powerpc-MSI-HSTA: Use kmalloc_array() in hsta_msi_probe() |
| Date | 2016-08-29 13:20 +0200 |
| Message-ID | <sbsLD-6Cn-3@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <sbsBX-6z7-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 29 Aug 2016 11:20:39 +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.
* Replace the specification of a data type 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@users.sourceforge.net>
---
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index 52a93dc..691db9a 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -156,7 +156,9 @@ static int hsta_msi_probe(struct platform_device *pdev)
if (ret)
goto out;
- ppc4xx_hsta_msi.irq_map = kmalloc(sizeof(int) * irq_count, GFP_KERNEL);
+ ppc4xx_hsta_msi.irq_map = kmalloc_array(irq_count,
+ sizeof(*ppc4xx_hsta_msi.irq_map),
+ GFP_KERNEL);
if (!ppc4xx_hsta_msi.irq_map) {
ret = -ENOMEM;
goto out1;
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] PowerPC: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:10 +0200 [PATCH 1/5] powerpc-mpic: Use kmalloc_array() in mpic_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:10 +0200 [PATCH 3/5] powerpc-MSI-HSTA: Use kmalloc_array() in hsta_msi_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:20 +0200 [PATCH 4/5] powerpc-MSI-HSTA: Rename jump labels in hsta_msi_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:20 +0200 [PATCH 2/5] powerpc-MSI: Use kmalloc_array() in ppc4xx_setup_msi_irqs() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:20 +0200 [PATCH 5/5] powerpc-MSI-HSTA: Move three assignments in hsta_msi_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 13:20 +0200
csiph-web