Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751865AbdF3ICJ (ORCPT ); Fri, 30 Jun 2017 04:02:09 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:36620 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778AbdF3ICG (ORCPT ); Fri, 30 Jun 2017 04:02:06 -0400 Date: Fri, 30 Jun 2017 11:00:49 +0300 From: Dan Carpenter To: Jason Cooper , Thomas Petazzoni Cc: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] irqchip/irq-mvebu-gicp: allocate enough memory for spi_bitmap Message-ID: <20170630080049.xr7luy5dfqdrfb57@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 735 Lines: 21 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 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;