Message ID | Pine.LNX.4.64.0903270801020.5354@usbsys.site |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, Mar 27, 2009 at 01:31:36PM +0300, Dan Carpenter wrote: > 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. > Ick... that's a good catch. I'll have to think about this. regards, Kyle > --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- 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),