Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] cifs: Fix endian types in struct rfc1002_session_packet
@ 2025-01-01 13:21 Pali Rohár
  0 siblings, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2025-01-01 13:21 UTC (permalink / raw)
  To: Steve French, Paulo Alcantara; +Cc: linux-cifs, linux-kernel

All fields in struct rfc1002_session_packet are in big endian. This is
because all NetBIOS packet headers are in big endian as opposite of SMB
structures which are in little endian.

Therefore use __be16 and __be32 types instead of __u16 and __u32 in
struct rfc1002_session_packet.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 fs/smb/client/rfc1002pdu.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/rfc1002pdu.h b/fs/smb/client/rfc1002pdu.h
index ae1d025da294..ac82c2f3a4a2 100644
--- a/fs/smb/client/rfc1002pdu.h
+++ b/fs/smb/client/rfc1002pdu.h
@@ -24,7 +24,7 @@
 struct rfc1002_session_packet {
 	__u8	type;
 	__u8	flags;
-	__u16	length;
+	__be16	length;
 	union {
 		struct {
 			__u8 called_len;
@@ -35,8 +35,8 @@ struct rfc1002_session_packet {
 			__u8 scope2; /* null */
 		} __attribute__((packed)) session_req;
 		struct {
-			__u32 retarget_ip_addr;
-			__u16 port;
+			__be32 retarget_ip_addr;
+			__be16 port;
 		} __attribute__((packed)) retarget_resp;
 		__u8 neg_ses_resp_error_code;
 		/* POSITIVE_SESSION_RESPONSE packet does not include trailer.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] cifs: Fix endian types in struct rfc1002_session_packet
@ 2025-01-19 19:21 Steve French
  2025-01-19 19:28 ` Pali Rohár
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2025-01-19 19:21 UTC (permalink / raw)
  To: Pali Rohár; +Cc: CIFS

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

    > All fields in struct rfc1002_session_packet are in big endian. This is
    > because all NetBIOS packet headers are in big endian as opposite of SMB
    >structures which are in little endian.
    > Therefore use __be16 and __be32 types instead of __u16 and __u32 in
    >struct rfc1002_session_packet.
    >
    >Reported-by: kernel test robot <lkp@intel.com>

Do you have a link to the kernel bot reported by (email?)

-- 
Thanks,

Steve

[-- Attachment #2: 0029-cifs-Fix-endian-types-in-struct-rfc1002_session_pack.patch --]
[-- Type: text/x-patch, Size: 1506 bytes --]

From bbd8ad0d8994d448aa12e9df5fe23e5847729909 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Wed, 25 Dec 2024 15:54:22 +0100
Subject: [PATCH 29/71] cifs: Fix endian types in struct rfc1002_session_packet
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

All fields in struct rfc1002_session_packet are in big endian. This is
because all NetBIOS packet headers are in big endian as opposite of SMB
structures which are in little endian.

Therefore use __be16 and __be32 types instead of __u16 and __u32 in
struct rfc1002_session_packet.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 fs/smb/client/rfc1002pdu.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/rfc1002pdu.h b/fs/smb/client/rfc1002pdu.h
index ae1d025da294..ac82c2f3a4a2 100644
--- a/fs/smb/client/rfc1002pdu.h
+++ b/fs/smb/client/rfc1002pdu.h
@@ -24,7 +24,7 @@
 struct rfc1002_session_packet {
 	__u8	type;
 	__u8	flags;
-	__u16	length;
+	__be16	length;
 	union {
 		struct {
 			__u8 called_len;
@@ -35,8 +35,8 @@ struct rfc1002_session_packet {
 			__u8 scope2; /* null */
 		} __attribute__((packed)) session_req;
 		struct {
-			__u32 retarget_ip_addr;
-			__u16 port;
+			__be32 retarget_ip_addr;
+			__be16 port;
 		} __attribute__((packed)) retarget_resp;
 		__u8 neg_ses_resp_error_code;
 		/* POSITIVE_SESSION_RESPONSE packet does not include trailer.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-19 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-01 13:21 [PATCH] cifs: Fix endian types in struct rfc1002_session_packet Pali Rohár
  -- strict thread matches above, loose matches on Subject: below --
2025-01-19 19:21 Steve French
2025-01-19 19:28 ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox