Commit 92b1f905 authored by David Rientjes's avatar David Rientjes Committed by Jeff Garzik

[PATCH] drivers cris: return on NULL dev_alloc_skb()

If the next descriptor array entry cannot be allocated by dev_alloc_skb(),
return immediately so it is not dereferenced later.  We cannot register the
device with a partial descriptor list.

Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: default avatarDavid Rientjes <rientjes@cs.washington.edu>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent ace48ffb
...@@ -509,6 +509,8 @@ etrax_ethernet_init(void) ...@@ -509,6 +509,8 @@ etrax_ethernet_init(void)
* does not share cacheline with any other data (to avoid cache bug) * does not share cacheline with any other data (to avoid cache bug)
*/ */
RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
if (!RxDescList[i].skb)
return -ENOMEM;
RxDescList[i].descr.ctrl = 0; RxDescList[i].descr.ctrl = 0;
RxDescList[i].descr.sw_len = MAX_MEDIA_DATA_SIZE; RxDescList[i].descr.sw_len = MAX_MEDIA_DATA_SIZE;
RxDescList[i].descr.next = virt_to_phys(&RxDescList[i + 1]); RxDescList[i].descr.next = virt_to_phys(&RxDescList[i + 1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment