[PATCH net-next 4/6] netconsole: append release to sysdata

Breno Leitao posted 6 patches 9 months, 1 week ago
[PATCH net-next 4/6] netconsole: append release to sysdata
Posted by Breno Leitao 9 months, 1 week ago
Append the init_utsname()->release to sysdata buffer before sending the
message in case the feature is set.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/netconsole.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 970dfc3ac9d41..0a7981ef752c7 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1238,6 +1238,14 @@ static int sysdata_append_taskname(struct netconsole_target *nt, int offset)
 			 MAX_EXTRADATA_ENTRY_LEN, " taskname=%s\n",
 			 current->comm);
 }
+
+static int sysdata_append_release(struct netconsole_target *nt, int offset)
+{
+	return scnprintf(&nt->extradata_complete[offset],
+			 MAX_EXTRADATA_ENTRY_LEN, " release=%s\n",
+			 init_utsname()->release);
+}
+
 /*
  * prepare_extradata - append sysdata at extradata_complete in runtime
  * @nt: target to send message to
@@ -1259,6 +1267,8 @@ static int prepare_extradata(struct netconsole_target *nt)
 		extradata_len += sysdata_append_cpu_nr(nt, extradata_len);
 	if (nt->sysdata_fields & SYSDATA_TASKNAME)
 		extradata_len += sysdata_append_taskname(nt, extradata_len);
+	if (nt->sysdata_fields & SYSDATA_RELEASE)
+		extradata_len += sysdata_append_release(nt, extradata_len);
 
 	WARN_ON_ONCE(extradata_len >
 		     MAX_EXTRADATA_ENTRY_LEN * MAX_EXTRADATA_ITEMS);

-- 
2.47.1
Re: [PATCH net-next 4/6] netconsole: append release to sysdata
Posted by Simon Horman 9 months ago
On Fri, Mar 14, 2025 at 10:58:48AM -0700, Breno Leitao wrote:
> Append the init_utsname()->release to sysdata buffer before sending the
> message in case the feature is set.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

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