aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@cs.washington.edu>2006-10-30 14:19:25 -0800
committerJeff Garzik <jeff@garzik.org>2006-10-31 20:22:06 -0500
commit2ceaac755423cb93c1bb2f59ebd1a06f027ac095 (patch)
treeb453d54375166f142b2cbca436689f170f3f89f9 /drivers/net/s2io.c
parent1e1675ccf758cbb4303ab052d58405cda6c745a7 (diff)
[PATCH] net s2io: return on NULL dev_alloc_skb()
Checks for NULL dev_alloc_skb() and returns on true to avoid subsequent dereference. Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Christoph Hellwig <hch@infrared.org> Signed-off-by: David Rientjes <rientjes@cs.washington.edu> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index a231ab7d28d..33569ec9dbf 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -5985,6 +5985,11 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
((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,
@@ -6007,7 +6012,11 @@ static int set_rxd_buffer_pointer(nic_t *sp, RxD_t *rxdp, buffAdd_t *ba,
((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,
PCI_DMA_FROMDEVICE);