[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090328024754.GA16554@bombadil.infradead.org>
Date: Fri, 27 Mar 2009 22:47:54 -0400
From: Kyle McMartin <kyle@...artin.ca>
To: Dan Carpenter <error27@...il.com>
Cc: grundler@...isc-linux.org, kyle@...artin.ca, netdev@...r.kernel.org
Subject: Re: Null dereference in uli526x_rx_packet()
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists