[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0903270801020.5354@usbsys.site>
Date: Fri, 27 Mar 2009 13:31:36 +0300 (EAT)
From: Dan Carpenter <error27@...il.com>
To: grundler@...isc-linux.org, kyle@...artin.ca
cc: netdev@...r.kernel.org
Subject: Null dereference in uli526x_rx_packet()
Smatch (http://repo.or.cz/w/smatch.git/) complains about the error
handling in uli526x_rx_packet().
I don't know if the right fix is to return like this patch does or to set
skb = rxptr->rx_skb_ptr again.
regards,
dan carpenter
--- orig/drivers/net/tulip/uli526x.c 2009-03-27 07:52:32.000000000 +0300
+++ devel/drivers/net/tulip/uli526x.c 2009-03-27 07:57:05.000000000 +0300
@@ -844,10 +844,13 @@
/* Good packet, send to upper layer */
/* Shorst packet used new SKB */
- if ( (rxlen < RX_COPY_SIZE) &&
- ( (skb = dev_alloc_skb(rxlen + 2) )
- != NULL) ) {
- /* size less than COPY_SIZE, allocate a rxlen SKB */
+ /* size less than COPY_SIZE, allocate a rxlen SKB */
+ if (rxlen < RX_COPY_SIZE) {
+ skb = dev_alloc_skb(rxlen + 2);
+ if (!skb)
+ return;
+ }
+ if (rxlen < RX_COPY_SIZE) {
skb_reserve(skb, 2); /* 16byte align */
memcpy(skb_put(skb, rxlen),
skb_tail_pointer(rxptr->rx_skb_ptr),
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists