hi,

coverity spotted two dev_alloc_skb() calls,
where we use the return value without checking it
for NULL. This patch simply adds the check, including
the debug message that is used in all other dev_alloc_skb()
calls.

Signed-off-by: Eric Sesterhenn <[EMAIL PROTECTED]>

--- linux-2.6.18-git8/drivers/net/s2io.c.orig   2006-09-28 01:25:36.000000000 
+0200
+++ linux-2.6.18-git8/drivers/net/s2io.c        2006-09-28 01:26:32.000000000 
+0200
@@ -5989,6 +5989,12 @@ static int set_rxd_buffer_pointer(nic_t 
                        ((RxD3_t*)rxdp)->Buffer1_ptr = *temp1;
                } else {
                        *skb = dev_alloc_skb(size);
+                       if (!*skb) {
+                               DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \
+                                       failed\n ", dev->name);
+                                       return -ENOMEM;
+                       }
+
                        ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2 =
                                pci_map_single(sp->pdev, (*skb)->data,
                                               dev->mtu + 4,
@@ -6011,6 +6017,11 @@ static int set_rxd_buffer_pointer(nic_t 
                        ((RxD3_t*)rxdp)->Buffer2_ptr = *temp2;
                } else {
                        *skb = dev_alloc_skb(size);
+                       if (!*skb) {
+                               DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \
+                                       failed\n ", dev->name);
+                               return -ENOMEM;
+                       }
 
                        ((RxD3_t*)rxdp)->Buffer0_ptr = *temp0 =
                                pci_map_single(sp->pdev, ba->ba_0, BUF0_LEN,


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to