From: Moon Yeounsu <yyyynoom@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
intel-wired-lan@lists.osuosl.org,
Moon Yeounsu <yyyynoom@gmail.com>
Subject: [PATCH] e1000e: use ip_hdrlen() instead of bit shift
Date: Thu, 1 Aug 2024 22:47:10 +0900 [thread overview]
Message-ID: <20240801134709.1737190-2-yyyynoom@gmail.com> (raw)
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));
if (ntohs(udp->dest) != 67)
return 0;
--
2.45.2
next reply other threads:[~2024-08-01 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 13:47 Moon Yeounsu [this message]
2024-08-01 14:06 ` [PATCH] e1000e: use ip_hdrlen() instead of bit shift Florian Westphal
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=20240801134709.1737190-2-yyyynoom@gmail.com \
--to=yyyynoom@gmail.com \
--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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).