]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rds: Correct endian annotation of port and addr assignments
authorSimon Horman <horms@kernel.org>
Thu, 19 Jun 2025 13:58:32 +0000 (14:58 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Jun 2025 14:35:38 +0000 (07:35 -0700)
commit6e307a873d30ce027ff08ea6bb42a0fe6dda125d
treec306c327d553425fc4d0909757824d509e5fbc66
parent4672aec56d2e8edabcb74c3e2320301d106a377e
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.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Link: https://patch.msgid.link/20250619-rds-minor-v1-1-86d2ee3a98b9@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rds/tcp_listen.c