]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netconsole: Include sysdata in extradata entry count
authorBreno Leitao <leitao@debian.org>
Thu, 6 Feb 2025 11:05:56 +0000 (03:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Feb 2025 15:04:18 +0000 (15:04 +0000)
Modify count_extradata_entries() to include sysdata fields when
calculating the total number of extradata entries. This change ensures
that the sysdata feature, specifically the CPU number field, is
correctly counted against the MAX_EXTRADATA_ITEMS limit.

The modification adds a simple check for the CPU_NR flag in the
sysdata_fields, incrementing the entry count accordingly.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netconsole.c

index 710330ae8ee462083dbb4aa889cb0ba0cb5a7475..50739c7dbfb6ad5b1a65ef33325cf4dd6ed02031 100644 (file)
@@ -694,7 +694,15 @@ out_unlock:
  */
 static size_t count_extradata_entries(struct netconsole_target *nt)
 {
-       return list_count_nodes(&nt->userdata_group.cg_children);
+       size_t entries;
+
+       /* Userdata entries */
+       entries = list_count_nodes(&nt->userdata_group.cg_children);
+       /* Plus sysdata entries */
+       if (nt->sysdata_fields & CPU_NR)
+               entries += 1;
+
+       return entries;
 }
 
 static ssize_t remote_mac_store(struct config_item *item, const char *buf,