diff mbox series

[net-next] net: macsec: Add endianness annotations in salt struct

Message ID 20250117112228.90948-1-anezbeda@redhat.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: macsec: Add endianness annotations in salt struct | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
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: 1 this patch: 1
netdev/build_tools success Errors and warnings before: 0 (+1) this patch: 0 (+1)
netdev/cc_maintainers warning 4 maintainers not CCed: horms@kernel.org edumazet@google.com pabeni@redhat.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 347 this patch: 347
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: 112 this patch: 108
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 22 this patch: 22
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-17--15-00 (tests: 887)

Commit Message

Ales Nezbeda Jan. 17, 2025, 11:22 a.m. UTC
This change resolves warning produced by sparse tool as currently
there is a mismatch between normal generic type in salt and endian
annotated type in macsec driver code. Endian annotated types should
be used here.

Sparse output:
warning: restricted ssci_t degrades to integer
warning: incorrect type in assignment (different base types)
    expected restricted ssci_t [usertype] ssci
    got unsigned int
warning: restricted __be64 degrades to integer
warning: incorrect type in assignment (different base types)
    expected restricted __be64 [usertype] pn
    got unsigned long long

Signed-off-by: Ales Nezbeda <anezbeda@redhat.com>
---
 include/net/macsec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Horman Jan. 17, 2025, 6:18 p.m. UTC | #1
On Fri, Jan 17, 2025 at 12:22:28PM +0100, Ales Nezbeda wrote:
> This change resolves warning produced by sparse tool as currently
> there is a mismatch between normal generic type in salt and endian
> annotated type in macsec driver code. Endian annotated types should
> be used here.
> 
> Sparse output:
> warning: restricted ssci_t degrades to integer
> warning: incorrect type in assignment (different base types)
>     expected restricted ssci_t [usertype] ssci
>     got unsigned int
> warning: restricted __be64 degrades to integer
> warning: incorrect type in assignment (different base types)
>     expected restricted __be64 [usertype] pn
>     got unsigned long long
> 
> Signed-off-by: Ales Nezbeda <anezbeda@redhat.com>

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/include/net/macsec.h b/include/net/macsec.h
index de216cbc6b05..bc7de5b53e54 100644
--- a/include/net/macsec.h
+++ b/include/net/macsec.h
@@ -38,8 +38,8 @@  struct metadata_dst;
 
 typedef union salt {
 	struct {
-		u32 ssci;
-		u64 pn;
+		ssci_t ssci;
+		__be64 pn;
 	} __packed;
 	u8 bytes[MACSEC_SALT_LEN];
 } __packed salt_t;