[PATCH] powerpc/44x: fix ocm_block allocation

Ilia Mirkin imirkin at alum.mit.edu
Sat Dec 7 11:43:37 EST 2013


Allocate enough memory for the ocm_block structure, not just a pointer
to it.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

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);
-- 
1.8.3.2



More information about the Linuxppc-dev mailing list