diff mbox

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

Message ID 20170630080049.xr7luy5dfqdrfb57@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter June 30, 2017, 8 a.m. UTC
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>

Comments

Thomas Petazzoni June 30, 2017, 8:10 a.m. UTC | #1
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
diff mbox

Patch

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;