All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Moon Yeounsu <yyyynoom@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	edumazet@google.com, intel-wired-lan@lists.osuosl.org,
	kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH] e1000e: use ip_hdrlen() instead of bit shift
Date: Thu, 1 Aug 2024 16:06:33 +0200	[thread overview]
Message-ID: <20240801140633.GA2680@breakpoint.cc> (raw)
In-Reply-To: <20240801134709.1737190-2-yyyynoom@gmail.com>

Moon Yeounsu <yyyynoom@gmail.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@gmail.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.

WARNING: multiple messages have this Message-ID (diff)
From: Florian Westphal <fw@strlen.de>
To: Moon Yeounsu <yyyynoom@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH] e1000e: use ip_hdrlen() instead of bit shift
Date: Thu, 1 Aug 2024 16:06:33 +0200	[thread overview]
Message-ID: <20240801140633.GA2680@breakpoint.cc> (raw)
In-Reply-To: <20240801134709.1737190-2-yyyynoom@gmail.com>

Moon Yeounsu <yyyynoom@gmail.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@gmail.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.

  reply	other threads:[~2024-08-01 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 13:47 [Intel-wired-lan] [PATCH] e1000e: use ip_hdrlen() instead of bit shift Moon Yeounsu
2024-08-01 13:47 ` Moon Yeounsu
2024-08-01 14:06 ` Florian Westphal [this message]
2024-08-01 14:06   ` Florian Westphal
2024-08-02  2:25   ` [Intel-wired-lan] " Moon Yeounsu
2024-08-02  2:25     ` Moon Yeounsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240801140633.GA2680@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yyyynoom@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.