Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1678586 > unrolled thread

[PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-06-30 10:10 +0200
Last post2017-06-30 10:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap Dan Carpenter <dan.carpenter@oracle.com> - 2017-06-30 10:10 +0200
    Re: [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for  spi_bitmap Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2017-06-30 10:20 +0200

#1678586 — [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-06-30 10:10 +0200
Subject[PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap
Message-ID<tXZa2-2WX-23@gated-at.bofh.it>
BITS_TO_LONGS() gives us the number of longs we need, but we want to
allocate the number of bytes.

Fixes: a68a63cb4dfc ("irqchip/irq-mvebu-gicp: Add new driver for Marvell GICP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c
index 45358ac9bb1d..b283fc90be1e 100644
--- a/drivers/irqchip/irq-mvebu-gicp.c
+++ b/drivers/irqchip/irq-mvebu-gicp.c
@@ -226,8 +226,8 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
 	}
 
 	gicp->spi_bitmap = devm_kzalloc(&pdev->dev,
-					BITS_TO_LONGS(gicp->spi_cnt),
-					GFP_KERNEL);
+				BITS_TO_LONGS(gicp->spi_cnt) * sizeof(long),
+				GFP_KERNEL);
 	if (!gicp->spi_bitmap)
 		return -ENOMEM;
 

[toc] | [next] | [standalone]


#1678588 — Re: [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap

FromThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date2017-06-30 10:20 +0200
SubjectRe: [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap
Message-ID<tXZjH-30A-1@gated-at.bofh.it>
In reply to#1678586
Hello,

On Fri, 30 Jun 2017 11:00:49 +0300, Dan Carpenter wrote:
> BITS_TO_LONGS() gives us the number of longs we need, but we want to
> allocate the number of bytes.
> 
> Fixes: a68a63cb4dfc ("irqchip/irq-mvebu-gicp: Add new driver for Marvell GICP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Indeed:

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thanks for spotting the mistake.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web