netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Null dereference in uli526x_rx_packet()
@ 2009-03-27 10:31 Dan Carpenter
  2009-03-28  2:47 ` Kyle McMartin
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2009-03-27 10:31 UTC (permalink / raw)
  To: grundler, kyle; +Cc: netdev

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),

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-03-27  6:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-27 10:31 Null dereference in uli526x_rx_packet() Dan Carpenter
2009-03-28  2:47 ` Kyle McMartin
2009-03-28  3:23   ` Kyle McMartin
2009-03-29  5:35     ` Grant Grundler
2009-03-29  6:59       ` David Miller
2009-04-13  2:45         ` Grant Grundler
2009-04-13  2:56           ` David Miller
2010-02-07  7:15         ` Grant Grundler
2010-03-27  3:21           ` David Miller
2010-03-27  6:08             ` Grant Grundler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).