mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
xfrm: snmp: do not use SNMP_MIB_SENTINEL anymore
Use ARRAY_SIZE(), so that we know the limit at compile time. Signed-off-by: Eric Dumazet <[email protected]> Cc: Steffen Klassert <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
1 parent
3a951f9520
commit
c73d583e70
1 file changed
+6
-6
@@ -45,21 +45,21 @@ static const struct snmp_mib xfrm_mib_list[] = {
|
||||
SNMP_MIB_ITEM("XfrmInStateDirError", LINUX_MIB_XFRMINSTATEDIRERROR),
|
||||
SNMP_MIB_ITEM("XfrmInIptfsError", LINUX_MIB_XFRMINIPTFSERROR),
|
||||
SNMP_MIB_ITEM("XfrmOutNoQueueSpace", LINUX_MIB_XFRMOUTNOQSPACE),
|
||||
SNMP_MIB_SENTINEL
|
||||
};
|
||||
|
||||
static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
unsigned long buff[LINUX_MIB_XFRMMAX];
|
||||
unsigned long buff[ARRAY_SIZE(xfrm_mib_list)];
|
||||
const int cnt = ARRAY_SIZE(xfrm_mib_list);
|
||||
struct net *net = seq->private;
|
||||
int i;
|
||||
|
||||
memset(buff, 0, sizeof(unsigned long) * LINUX_MIB_XFRMMAX);
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
xfrm_state_update_stats(net);
|
||||
snmp_get_cpu_field_batch(buff, xfrm_mib_list,
|
||||
net->mib.xfrm_statistics);
|
||||
for (i = 0; xfrm_mib_list[i].name; i++)
|
||||
snmp_get_cpu_field_batch_cnt(buff, xfrm_mib_list, cnt,
|
||||
net->mib.xfrm_statistics);
|
||||
for (i = 0; i < cnt; i++)
|
||||
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
|
||||
buff[i]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user