[PATCH] ipw2200: Missing kmalloc check
authorPanagiotis Issaris <panagiotis.issaris@gmail.com>
Mon, 5 Sep 2005 02:14:10 +0000 (04:14 +0200)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 28 Oct 2005 20:57:20 +0000 (16:57 -0400)
The ipw2200 driver code in current GIT contains a kmalloc() followed by
a memset() without handling a possible memory allocation failure.

Signed-off-by: Panagiotis Issaris <panagiotis.issaris@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/wireless/ipw2200.c

index de4e6c23e4b8693a23da434d66d6269b49519974..3db0c32afe82d1965186654f443c85b23846f6fb 100644 (file)
@@ -4030,6 +4030,10 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv)
        int i;
 
        rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
+       if (unlikely(!rxq)) {
+               IPW_ERROR("memory allocation failed\n");
+               return NULL;
+       }
        memset(rxq, 0, sizeof(*rxq));
        spin_lock_init(&rxq->lock);
        INIT_LIST_HEAD(&rxq->rx_free);