From patchwork Sat Dec 7 00:43:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 298613 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 92E632C0343 for ; Sat, 7 Dec 2013 13:38:19 +1100 (EST) Received: from mail-qe0-x22c.google.com (mail-qe0-x22c.google.com [IPv6:2607:f8b0:400d:c02::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 305F72C00AD for ; Sat, 7 Dec 2013 11:43:52 +1100 (EST) Received: by mail-qe0-f44.google.com with SMTP id nd7so1143582qeb.31 for ; Fri, 06 Dec 2013 16:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=r8IIXl/NNUUzSsHO0PW+z9i9JsJfqAabTkdQ0okf2Bk=; b=l7OblCrjEib59QL7yIvFNlnaOCDEudK9qIQzp8uv+qJGdXTDc2rS1iS1Ij5Lfay38T lmkybd4FG1SVEN+4MKPUC6V3BC2WrDKDMa5p8nKiDcEsaksYry5ztsRhkU04ol98BXgZ EluOgGyTUvMgDdFYPkGFVL97qps6SsV7Oxr8zSHcebqJGmGpXDyVG5yY0oLllk23T57W ZsmF5l9OdOR5Cc8myUdijqIYKzdpsYchGmMbb0h0G2ozpVReN3eqEc0q4MiCV55hFVTI COwyKbD2Ijr+0tKwjag7d4IgxJitbzuMUzsaEF6K7sG9zblUdUmkDTNTBnHdqxb162ku nblw== X-Received: by 10.224.96.129 with SMTP id h1mr11870493qan.14.1386377027453; Fri, 06 Dec 2013 16:43:47 -0800 (PST) Received: from localhost.localdomain (cpe-74-71-31-84.nyc.res.rr.com. [74.71.31.84]) by mx.google.com with ESMTPSA id n14sm1325013qav.8.2013.12.06.16.43.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2013 16:43:47 -0800 (PST) From: Ilia Mirkin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/44x: fix ocm_block allocation Date: Fri, 6 Dec 2013 19:43:37 -0500 Message-Id: <1386377017-909-1-git-send-email-imirkin@alum.mit.edu> X-Mailer: git-send-email 1.8.3.2 X-Mailman-Approved-At: Sat, 07 Dec 2013 13:37:56 +1100 Cc: Vinh Nguyen Huu Tuong , Ilia Mirkin X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Allocate enough memory for the ocm_block structure, not just a pointer to it. Signed-off-by: Ilia Mirkin --- I have neither the hardware to test nor the toolchain to even build-test this. However this seems like a fairly obvious fix (and I have to wonder how this ever worked at all). Found with spatch. Actually further investigation makes it seem like this function is never called, perhaps it should just be removed? If it is kept around though, would be nice to apply this patch so that tools don't trip over this wrong code. arch/powerpc/sysdev/ppc4xx_ocm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c index b7c4345..85d9e37 100644 --- a/arch/powerpc/sysdev/ppc4xx_ocm.c +++ b/arch/powerpc/sysdev/ppc4xx_ocm.c @@ -339,7 +339,7 @@ void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align, if (IS_ERR_VALUE(offset)) continue; - ocm_blk = kzalloc(sizeof(struct ocm_block *), GFP_KERNEL); + ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL); if (!ocm_blk) { printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block"); rh_free(ocm_reg->rh, offset);