Skip to content

Commit 2bae25b

Browse files
leitaodavem330
authored andcommitted
netconsole: Include sysdata in extradata entry count
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>
1 parent 364f678 commit 2bae25b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/net/netconsole.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,15 @@ static ssize_t remote_ip_store(struct config_item *item, const char *buf,
694694
*/
695695
static size_t count_extradata_entries(struct netconsole_target *nt)
696696
{
697-
return list_count_nodes(&nt->userdata_group.cg_children);
697+
size_t entries;
698+
699+
/* Userdata entries */
700+
entries = list_count_nodes(&nt->userdata_group.cg_children);
701+
/* Plus sysdata entries */
702+
if (nt->sysdata_fields & CPU_NR)
703+
entries += 1;
704+
705+
return entries;
698706
}
699707

700708
static ssize_t remote_mac_store(struct config_item *item, const char *buf,

0 commit comments

Comments
 (0)