From: Kenny Ho <Kenny.Ho@amd.com>
To: David Laight <David.Laight@aculab.com>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Marc Dionne <marc.dionne@auristor.com>,
"Kenny Ho" <y2kenny@gmail.com>,
David Howells <dhowells@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"linux-afs@lists.infradead.org" <linux-afs@lists.infradead.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
<alexander.deucher@amd.com>
Cc: Kenny Ho <Kenny.Ho@amd.com>
Subject: [PATCH] Truncate UTS_RELEASE for rxrpc version
Date: Thu, 25 May 2023 17:13:46 -0400 [thread overview]
Message-ID: <20230525211346.718562-1-Kenny.Ho@amd.com> (raw)
UTS_RELEASE has maximum length of 64 which can cause rxrpc_version to
exceed the 65 byte message limit.
Per https://web.mit.edu/kolya/afs/rx/rx-spec
"If a server receives a packet with a type value of 13, and the
client-initiated flag set, it should respond with a 65-byte payload
containing a string that identifies the version of AFS software it is
running."
Current implementation causes compile error when WERROR is turned on and
when UTS_RELEASE exceed the length of 49 (making the version string more
than 64 characters.)
Signed-off-by: Kenny Ho <Kenny.Ho@amd.com>
---
net/rxrpc/local_event.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/local_event.c b/net/rxrpc/local_event.c
index 19e929c7c38b..90af6fbb9266 100644
--- a/net/rxrpc/local_event.c
+++ b/net/rxrpc/local_event.c
@@ -16,8 +16,6 @@
#include <generated/utsrelease.h>
#include "ar-internal.h"
-static const char rxrpc_version_string[65] = "linux-" UTS_RELEASE " AF_RXRPC";
-
/*
* Reply to a version request
*/
@@ -30,6 +28,7 @@ static void rxrpc_send_version_request(struct rxrpc_local *local,
struct sockaddr_rxrpc srx;
struct msghdr msg;
struct kvec iov[2];
+ static char rxrpc_version_string[65];
size_t len;
int ret;
@@ -38,6 +37,12 @@ static void rxrpc_send_version_request(struct rxrpc_local *local,
if (rxrpc_extract_addr_from_skb(&srx, skb) < 0)
return;
+ if (!rxrpc_version_string[0])
+ snprintf(rxrpc_version_string,
+ sizeof(rxrpc_version_string),
+ "linux-%.49s AF_RXRPC",
+ UTS_RELEASE);
+
msg.msg_name = &srx.transport;
msg.msg_namelen = srx.transport_len;
msg.msg_control = NULL;
--
2.25.1
next reply other threads:[~2023-05-25 21:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 21:13 Kenny Ho [this message]
2023-05-25 22:09 ` [PATCH] Truncate UTS_RELEASE for rxrpc version David Howells
2023-05-25 22:28 ` Kenny Ho
2023-05-25 22:52 ` David Howells
2023-05-26 9:38 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230525211346.718562-1-Kenny.Ho@amd.com \
--to=kenny.ho@amd.com \
--cc=David.Laight@aculab.com \
--cc=alexander.deucher@amd.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=y2kenny@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).