Skip to contentSkip to conversation

rds: Minor updates for spelling and endian

PATCH Applied Simon Horman 3 participants 6 messages Jun 19, 2025 – Jun 21, 2025

Subsystems (4)
lore
Share & tools
lore

Simon Horman

author reviewer
#0 lore raw

cover rds: Minor updates for spelling and endian

Hi,

This short series addressses some cosmetic issues in rds.

1. Some spelling errors, as flagged by spellcheck
2. Some endianness annotation errors, which are not bugs, flagged by Sparse

---
Simon Horman (2):
rds: Correct endian annotation of port and addr assignments
rds: Correct spelling

 net/rds/af_rds.c     | 2 +-
 net/rds/send.c       | 2 +-
 net/rds/tcp_listen.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

base-commit: fc4842cd0f117042a648cf565da4db0c04a604be

author reviewer
#1 lore raw

PATCH 1/2 rds: Correct endian annotation of port and addr assignments

Correct the endianness annotation of port assignments:

A host byte order value (RDS_TCP_PORT) is correctly converted to network byte order (big endian) using htons. But it is then cast back to host byte order before assigning to a variable that expects a big endian value. Address this by dropping the cast.

This is not a bug because, while the endian annotation is changed by this patch, the assigned value is unchanged.

Also correct the endianness of address assignment.

A host byte order value (INADDR_ANY) is incorrectly assigned as-is to a variable that expects a big endian value. Address this by converting the value to network byte order (big endian).

This is not a bug because INADDR_ANY is 0, which is isomorphic with regards to endian conversions. IOW, while the endian annotation is changed by this patch, the assigned value is unchanged.

Incorrect endian annotations appear to date back to IPv4-only code added by commit 70041088e3b9 ("RDS: Add TCP transport to RDS").

Flagged by Sparse.

---
 net/rds/tcp_listen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/rds/tcp_listen.c +3 -3
index d89bd8d0c354..b5c801c629a4 100644
@@ -298,15 +298,15 @@ struct socket *rds_tcp_listen_init(struct net *net, bool isv6)
 		sin6 = (struct sockaddr_in6 *)&ss;
 		sin6->sin6_family = PF_INET6;
 		sin6->sin6_addr = in6addr_any;
-		sin6->sin6_port = (__force u16)htons(RDS_TCP_PORT);
+		sin6->sin6_port = htons(RDS_TCP_PORT);
 		sin6->sin6_scope_id = 0;
 		sin6->sin6_flowinfo = 0;
 		addr_len = sizeof(*sin6);
 	} else {
 		sin = (struct sockaddr_in *)&ss;
 		sin->sin_family = PF_INET;
-		sin->sin_addr.s_addr = INADDR_ANY;
-		sin->sin_port = (__force u16)htons(RDS_TCP_PORT);
+		sin->sin_addr.s_addr = htonl(INADDR_ANY);
+		sin->sin_port = htons(RDS_TCP_PORT);
 		addr_len = sizeof(*sin);
 	}
 
Signature · 1 line
2.47.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH net-next 1/2] rds: Correct endian annotation of port and addr assignments

Quoted 20 lines · Simon Horman

Correct the endianness annotation of port assignments:

A host byte order value (RDS_TCP_PORT) is correctly converted to network byte order (big endian) using htons. But it is then cast back to host byte order before assigning to a variable that expects a big endian value. Address this by dropping the cast.

This is not a bug because, while the endian annotation is changed by this patch, the assigned value is unchanged.

Also correct the endianness of address assignment.

A host byte order value (INADDR_ANY) is incorrectly assigned as-is to a variable that expects a big endian value. Address this by converting the value to network byte order (big endian).

This is not a bug because INADDR_ANY is 0, which is isomorphic with regards to endian conversions. IOW, while the endian annotation is changed by this patch, the assigned value is unchanged.

Quoted 6 lines

Incorrect endian annotations appear to date back to IPv4-only code added by commit 70041088e3b9 ("RDS: Add TCP transport to RDS").

Flagged by Sparse.

These changes look fine to me. Thanks for the catch!

Quoted 28 lines
---
 net/rds/tcp_listen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/rds/tcp_listen.c +3 -3
index d89bd8d0c354..b5c801c629a4 100644
@@ -298,15 +298,15 @@ struct socket *rds_tcp_listen_init(struct net *net, bool isv6)
 		sin6 = (struct sockaddr_in6 *)&ss;
 		sin6->sin6_family = PF_INET6;
 		sin6->sin6_addr = in6addr_any;
-		sin6->sin6_port = (__force u16)htons(RDS_TCP_PORT);
+		sin6->sin6_port = htons(RDS_TCP_PORT);
 		sin6->sin6_scope_id = 0;
 		sin6->sin6_flowinfo = 0;
 		addr_len = sizeof(*sin6);
 	} else {
 		sin = (struct sockaddr_in *)&ss;
 		sin->sin_family = PF_INET;
-		sin->sin_addr.s_addr = INADDR_ANY;
-		sin->sin_port = (__force u16)htons(RDS_TCP_PORT);
+		sin->sin_addr.s_addr = htonl(INADDR_ANY);
+		sin->sin_port = htons(RDS_TCP_PORT);
 		addr_len = sizeof(*sin);
 	}
 
author reviewer
#3 lore raw

PATCH 2/2 rds: Correct spelling

In reply to Simon Horman

Correct spelling as flagged by codespell.
With these changes in place codespell only flags false positives in net/rds.

---
 net/rds/af_rds.c | 2 +-
 net/rds/send.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/rds/af_rds.c +1 -1
index 8435a20968ef..086a13170e09 100644
@@ -598,7 +598,7 @@ static int rds_connect(struct socket *sock, struct sockaddr *uaddr,
 		}
 
 		if (addr_type & IPV6_ADDR_LINKLOCAL) {
-			/* If socket is arleady bound to a link local address,
+			/* If socket is already bound to a link local address,
 			 * the peer address must be on the same link.
 			 */
 			if (sin6->sin6_scope_id == 0 ||
net/rds/send.c +1 -1
index 09a280110654..42d991bc8543 100644
@@ -232,7 +232,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
 		 * If not already working on one, grab the next message.
 		 *
 		 * cp_xmit_rm holds a ref while we're sending this message down
-		 * the connction.  We can use this ref while holding the
+		 * the connection.  We can use this ref while holding the
 		 * send_sem.. rds_send_reset() is serialized with it.
 		 */
 		if (!rm) {
Signature · 1 line
2.47.2
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH net-next 2/2] rds: Correct spelling

Quoted 5 lines · Simon Horman

Correct spelling as flagged by codespell.
With these changes in place codespell only flags false positives in net/rds.

This looks ok to me. Thanks for the cleanup!

Quoted 32 lines
---
 net/rds/af_rds.c | 2 +-
 net/rds/send.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/rds/af_rds.c +1 -1
index 8435a20968ef..086a13170e09 100644
@@ -598,7 +598,7 @@ static int rds_connect(struct socket *sock, struct sockaddr *uaddr,
 		}
 
 		if (addr_type & IPV6_ADDR_LINKLOCAL) {
-			/* If socket is arleady bound to a link local address,
+			/* If socket is already bound to a link local address,
 			 * the peer address must be on the same link.
 			 */
 			if (sin6->sin6_scope_id == 0 ||
net/rds/send.c +1 -1
index 09a280110654..42d991bc8543 100644
@@ -232,7 +232,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
 		 * If not already working on one, grab the next message.
 		 *
 		 * cp_xmit_rm holds a ref while we're sending this message down
-		 * the connction.  We can use this ref while holding the
+		 * the connection.  We can use this ref while holding the
 		 * send_sem.. rds_send_reset() is serialized with it.
 		 */
 		if (!rm) {
#5 lore raw
In reply to Simon Horman
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 19 Jun 2025 14:58:31 +0100 you wrote:

Hi,

This short series addressses some cosmetic issues in rds.

1. Some spelling errors, as flagged by spellcheck
2. Some endianness annotation errors, which are not bugs, flagged by Sparse

[...]

Here is the summary with links:
- [net-next,1/2] rds: Correct endian annotation of port and addr assignments

    https://git.kernel.org/netdev/net-next/c/6e307a873d30
  - [net-next,2/2] rds: Correct spelling
    https://git.kernel.org/netdev/net-next/c/433dce0692a0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html