[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240801140633.GA2680@breakpoint.cc>
Date: Thu, 1 Aug 2024 16:06:33 +0200
From: Florian Westphal <fw@...len.de>
To: Moon Yeounsu <yyyynoom@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, intel-wired-lan@...ts.osuosl.org
Subject: Re: [PATCH] e1000e: use ip_hdrlen() instead of bit shift
Moon Yeounsu <yyyynoom@...il.com> wrote:
> There's no reason to use bit shift to find the UDP header.
> It's not intuitive and it reinvents well-defined functions.
>
> Signed-off-by: Moon Yeounsu <yyyynoom@...il.com>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 360ee26557f7..07c4cf84bdf3 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -5731,7 +5731,7 @@ static int e1000_transfer_dhcp_info(struct e1000_adapter *adapter,
> if (ip->protocol != IPPROTO_UDP)
> return 0;
>
> - udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2));
> + udp = (struct udphdr *)((u8 *)ip + ip_hdrlen(skb));
This helper needs skb_network_header being set up correctly, are you
sure thats the case here? ip pointer is fetched via data + 14 right
above, so it doesn't look like this would work.
Powered by blists - more mailing lists