netconsole: add taskname to extradata entry count
authorBreno Leitao <leitao@debian.org>
Fri, 28 Feb 2025 12:50:20 +0000 (04:50 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 4 Mar 2025 14:28:28 +0000 (15:28 +0100)
New SYSDATA_TASKNAME feature flag to track when taskname append is enabled.

Additional check in count_extradata_entries() to include taskname in
total, counting it as an entry in extradata. This function is used to
check if we are not overflowing the number of extradata items.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/netconsole.c

index 96153fd01f46e750bcc40e609a62e7d4a72e2e5f..f46a0edf9c11e84ac1261a8b9a7d31b1ca3efbf7 100644 (file)
@@ -104,6 +104,8 @@ struct netconsole_target_stats  {
 enum sysdata_feature {
        /* Populate the CPU that sends the message */
        SYSDATA_CPU_NR = BIT(0),
+       /* Populate the task name (as in current->comm) in sysdata */
+       SYSDATA_TASKNAME = BIT(1),
 };
 
 /**
@@ -701,6 +703,8 @@ static size_t count_extradata_entries(struct netconsole_target *nt)
        /* Plus sysdata entries */
        if (nt->sysdata_fields & SYSDATA_CPU_NR)
                entries += 1;
+       if (nt->sysdata_fields & SYSDATA_TASKNAME)
+               entries += 1;
 
        return entries;
 }