Skip to contentSkip to conversation

net/wanrouter/wanmain.c: check kmalloc() return value.

PATCH In review Amit Choudhary 2 participants 2 messages Mar 9, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/wanrouter/wanmain.c: check kmalloc() return value.

Description: Check the return value of kmalloc() in function dbg_kmalloc(), in file net/wanrouter/wanmain.c.

net/wanrouter/wanmain.c +2 -0
index 316211d..263450c 100644
@@ -67,6 +67,8 @@ static void * dbg_kmalloc(unsigned int s
 	int i = 0;
 	void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio);
 	char * c1 = v;
+	if (!v)
+		return NULL;
 	c1 += sizeof(unsigned int);
 	*((unsigned int *)v) = size;
 
maintainer
#1 lore raw

From: Amit Choudhary <[email protected]>
Date: Thu, 8 Mar 2007 23:26:54 -0800

Quoted 3 lines

Description: Check the return value of kmalloc() in function dbg_kmalloc(), in file net/wanrouter/wanmain.c.

There is no reason for any subsystem to implement it's own debugging allocator when we have one that works perfectly fine already in SLAB.

So to fix this we should simply remove all of the allocation debugging code here.