diff mbox series

[net-next,2/2] octeontx2-pf: Make iplen __be16 in otx2_sqe_add_ext()

Message ID 20240903-octeontx2-sparse-v1-2-f190309ecb0a@kernel.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series octeontx2: Address some Sparse warnings | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 19 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Simon Horman Sept. 3, 2024, 4:26 p.m. UTC
In otx2_sqe_add_ext() iplen is used to hold a 16-bit big-endian value,
but it's type is u16, indicating a host byte order integer.

Address this mismatch by changing the type of iplen to __be16.

Flagged by Sparse as:

.../otx2_txrx.c:699:31: warning: incorrect type in assignment (different base types)
.../otx2_txrx.c:699:31:    expected unsigned short [usertype] iplen
.../otx2_txrx.c:699:31:    got restricted __be16 [usertype]
.../otx2_txrx.c:701:54: warning: incorrect type in assignment (different base types)
.../otx2_txrx.c:701:54:    expected restricted __be16 [usertype] tot_len
.../otx2_txrx.c:701:54:    got unsigned short [usertype] iplen
.../otx2_txrx.c:704:60: warning: incorrect type in assignment (different base types)
.../otx2_txrx.c:704:60:    expected restricted __be16 [usertype] payload_len
.../otx2_txrx.c:704:60:    got unsigned short [usertype] iplen

Introduced in
commit dc1a9bf2c816 ("octeontx2-pf: Add UDP segmentation offload support")

No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geetha sowjanya Sept. 4, 2024, 9:05 a.m. UTC | #1
>-----Original Message-----
>From: Simon Horman <horms@kernel.org>
>Sent: Tuesday, September 3, 2024 9:57 PM
>To: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Linu Cherian
><lcherian@marvell.com>; Geethasowjanya Akula <gakula@marvell.com>;
>Jerin Jacob <jerinj@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>;
>Subbaraya Sundeep Bhatta <sbhatta@marvell.com>
>Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet
><edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
><pabeni@redhat.com>; Nathan Chancellor <nathan@kernel.org>; Nick
>Desaulniers <ndesaulniers@google.com>; Bill Wendling
><morbo@google.com>; Justin Stitt <justinstitt@google.com>;
>netdev@vger.kernel.org; llvm@lists.linux.dev
>Subject: [EXTERNAL] [PATCH net-next 2/2] octeontx2-pf: Make iplen __be16 in
>otx2_sqe_add_ext()
>
>In otx2_sqe_add_ext() iplen is used to hold a 16-bit big-endian value, but it's
>type is u16, indicating a host byte order integer.
>
>Address this mismatch by changing the type of iplen to __be16.
>
>Flagged by Sparse as:
>
>.../otx2_txrx.c:699:31: warning: incorrect type in assignment (different base
>types)
>.../otx2_txrx.c:699:31:    expected unsigned short [usertype] iplen
>.../otx2_txrx.c:699:31:    got restricted __be16 [usertype]
>.../otx2_txrx.c:701:54: warning: incorrect type in assignment (different base
>types)
>.../otx2_txrx.c:701:54:    expected restricted __be16 [usertype] tot_len
>.../otx2_txrx.c:701:54:    got unsigned short [usertype] iplen
>.../otx2_txrx.c:704:60: warning: incorrect type in assignment (different base
>types)
>.../otx2_txrx.c:704:60:    expected restricted __be16 [usertype] payload_len
>.../otx2_txrx.c:704:60:    got unsigned short [usertype] iplen
>
>Introduced in
>commit dc1a9bf2c816 ("octeontx2-pf: Add UDP segmentation offload
>support")
>
>No functional change intended.
>Compile tested only.
>
>Signed-off-by: Simon Horman <horms@kernel.org>
>---
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>index 3eb85949677a..933e18ba2fb2 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>@@ -687,7 +687,7 @@ static void otx2_sqe_add_ext(struct otx2_nic *pfvf,
>struct otx2_snd_queue *sq,
> 		} else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
> 			__be16 l3_proto = vlan_get_protocol(skb);
> 			struct udphdr *udph = udp_hdr(skb);
>-			u16 iplen;
>+			__be16 iplen;
>
> 			ext->lso_sb = skb_transport_offset(skb) +
> 					sizeof(struct udphdr);
>
>--
>2.45.2
Tested-by: Geetha sowjanya <gakula@marvell.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 3eb85949677a..933e18ba2fb2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -687,7 +687,7 @@  static void otx2_sqe_add_ext(struct otx2_nic *pfvf, struct otx2_snd_queue *sq,
 		} else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
 			__be16 l3_proto = vlan_get_protocol(skb);
 			struct udphdr *udph = udp_hdr(skb);
-			u16 iplen;
+			__be16 iplen;
 
 			ext->lso_sb = skb_transport_offset(skb) +
 					sizeof(struct udphdr);