Skip to contentSkip to conversation

make kmalloc error return unconditional in hysdn_net.c (245ac1)

PATCH In review Rasmus Andersen 2 participants 2 messages May 28, 2001 – May 29, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make kmalloc error return unconditional in hysdn_net.c (245ac1)

Hi.

The patch below fixes what I believe is a bug in hysdn_net.c. I cannot see how we can proceed under _any_ circumstances after the kmalloc fails. Applies against 245ac1.

drivers/isdn/hysdn/hysdn_net.c +1 -2
@@ -304,8 +304,7 @@
 	hysdn_net_release(card);	/* release an existing net device */
 	if ((dev = kmalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) {
 		printk(KERN_WARNING "HYSDN: unable to allocate mem\n");
-		if (card->debug_flags & LOG_NET_INIT)
-			return (-ENOMEM);
+		return (-ENOMEM);
 	}
 	memset(dev, 0, sizeof(struct net_local));	/* clean the structure */
 
Signature · 4 lines
Regards,
        Rasmus([email protected])

It has just been discovered that research causes cancer in rats. 
#1 lore raw
Quoted 3 lines · Rasmus Andersen

The patch below fixes what I believe is a bug in hysdn_net.c. I cannot see how we can proceed under _any_ circumstances after the kmalloc fails. Applies against 245ac1.

Yep, you're obviously right. Thanks, I'll check in your patch into our CVS, and push it to Alan. Actually, maybe it makes sense to use alloc_netdev here, I'll have a look.

Thanks a lot,
--Kai