[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091207151326.GB17863@fluff.org.uk>
Date: Mon, 7 Dec 2009 15:13:26 +0000
From: Ben Dooks <ben@...ff.org.uk>
To: Neil Horman <nhorman@...driver.com>
Cc: netdev@...r.kernel.org, e1000-devel@...ts.sourceforge.net,
davem@...emloft.net, jeffrey.t.kirsher@...el.com,
jesse.brandeburg@...el.com, bruce.w.allan@...el.com,
peter.p.waskiewicz.jr@...el.com, john.ronciak@...el.com
Subject: Re: [PATCH 1/3] e1000: increase skb size to prevent dma over skb
boundary
On Mon, Dec 07, 2009 at 09:47:36AM -0500, Neil Horman wrote:
> Update e1000 driver to not allow dma beyond the end of the allocated skb
>
> Signed-off-by: Neil Horman <nhorman@...driver.com>
>
>
> e1000_main.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
>
> diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
> index 7e855f9..7600deb 100644
> --- a/drivers/net/e1000/e1000_main.c
> +++ b/drivers/net/e1000/e1000_main.c
> @@ -1667,6 +1667,19 @@ int e1000_setup_all_rx_resources(struct e1000_adapter *adapter)
> return err;
> }
>
> +static inline u32 normalize_rx_len(u32 len)
> +{
> + u32 match, last_match;
> +
> +
> + for (match = 0x100; match <= 0x4000; match *= 2) {
> + if (len <= match)
> + return match;
> + }
> +
> + return 0;
> +}
thought there was an ilog2() call in the kernel to do something like
this? see linux/log2.h. will also make it easier to switch on the
result if you've got a value in bit-position instead of size.
--
Ben (ben@...ff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
--
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