From patchwork Tue Apr 25 09:19:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9697791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0ECD560224 for ; Tue, 25 Apr 2017 09:43:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 087922845C for ; Tue, 25 Apr 2017 09:43:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F18CC284E5; Tue, 25 Apr 2017 09:42:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from mx1.tuxfamily.net (mail.tuxfamily.net [212.85.158.8]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77B282845C for ; Tue, 25 Apr 2017 09:42:59 +0000 (UTC) Received: from listengine (helo=tuxfamily.org) by mx1.tuxfamily.net with local-bsmtp (Exim 4.84_2) (envelope-from ) id 1d2wzq-00080q-18 for patchwork-linux-oxnas@patchwork.kernel.org; Tue, 25 Apr 2017 11:42:58 +0200 Received: from aserp1040.oracle.com ([141.146.126.69]) by mx1.tuxfamily.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d2wel-00065I-8A for linux-oxnas@lists.tuxfamily.org; Tue, 25 Apr 2017 11:21:11 +0200 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3P9K71u015704 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Apr 2017 09:20:08 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v3P9K7Z9022388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Apr 2017 09:20:07 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v3P9JxH6029296; Tue, 25 Apr 2017 09:20:01 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 25 Apr 2017 02:19:59 -0700 Date: Tue, 25 Apr 2017 12:19:49 +0300 From: Dan Carpenter To: Boris Brezillon , Neil Armstrong CC: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , linux-mtd@lists.infradead.org, linux-oxnas@lists.tuxfamily.org, kernel-janitors@vger.kernel.org Subject: [linux-oxnas] [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe() Message-ID: <20170425091949.uindhaxmbtsksqc7@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-Ip: userv0022.oracle.com [156.151.31.74] List-Unsubscribe: List-Subscribe: List-Help: List-Software: Listengine, VHFFS 4.7-dev-2b25a01d00 List-ID: List-Post: List-Archive: Precedence: list Reply-To: linux-oxnas@lists.tuxfamily.org X-Virus-Scanned: ClamAV using ClamSMTP We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192 bytes and not sizeof(struct nand_chip) which is a much larger 3056 bytes. Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support") Signed-off-by: Dan Carpenter Acked-by: Boris Brezillon diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c index 3e3bf3b364d2..1b207aac840c 100644 --- a/drivers/mtd/nand/oxnas_nand.c +++ b/drivers/mtd/nand/oxnas_nand.c @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev) int err = 0; /* Allocate memory for the device structure (and zero it) */ - oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip), + oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas), GFP_KERNEL); if (!oxnas) return -ENOMEM;