]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
be2net: Use correct byte order and format string for TCP seq and ack_seq
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Thu, 17 Jul 2025 19:35:47 +0000 (12:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:41:06 +0000 (18:41 +0200)
[ Upstream commit 4701ee5044fb3992f1c910630a9673c2dc600ce5 ]

The TCP header fields seq and ack_seq are 32-bit values in network
byte order as (__be32). these fields were earlier printed using
ntohs(), which converts only 16-bit values and produces incorrect
results for 32-bit fields. This patch is changeing the conversion
to ntohl(), ensuring correct interpretation of these sequence numbers.

Notably, the format specifier is updated from %d to %u to reflect the
unsigned nature of these fields.

improves the accuracy of debug log messages for TCP sequence and
acknowledgment numbers during TX timeouts.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250717193552.3648791-1-alok.a.tiwari@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/emulex/benet/be_main.c

index 3d2e215921191769094356fbea820eece091ddf2..490af665942947fd5ce8cc57f0a8a24e696e90f3 100644 (file)
@@ -1465,10 +1465,10 @@ static void be_tx_timeout(struct net_device *netdev, unsigned int txqueue)
                                                 ntohs(tcphdr->source));
                                        dev_info(dev, "TCP dest port %d\n",
                                                 ntohs(tcphdr->dest));
-                                       dev_info(dev, "TCP sequence num %d\n",
-                                                ntohs(tcphdr->seq));
-                                       dev_info(dev, "TCP ack_seq %d\n",
-                                                ntohs(tcphdr->ack_seq));
+                                       dev_info(dev, "TCP sequence num %u\n",
+                                                ntohl(tcphdr->seq));
+                                       dev_info(dev, "TCP ack_seq %u\n",
+                                                ntohl(tcphdr->ack_seq));
                                } else if (ip_hdr(skb)->protocol ==
                                           IPPROTO_UDP) {
                                        udphdr = udp_hdr(skb);