tls: 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 <edumazet@google.com> Cc: John Fastabend <john.fastabend@gmail.com> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Link: https://patch.msgid.link/20250905165813.1470708-8-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>pull/1354/merge
parent
52a33cae6a
commit
3a951f9520
|
|
@ -27,17 +27,19 @@ static const struct snmp_mib tls_mib_list[] = {
|
|||
SNMP_MIB_ITEM("TlsTxRekeyOk", LINUX_MIB_TLSTXREKEYOK),
|
||||
SNMP_MIB_ITEM("TlsTxRekeyError", LINUX_MIB_TLSTXREKEYERROR),
|
||||
SNMP_MIB_ITEM("TlsRxRekeyReceived", LINUX_MIB_TLSRXREKEYRECEIVED),
|
||||
SNMP_MIB_SENTINEL
|
||||
};
|
||||
|
||||
static int tls_statistics_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
unsigned long buf[LINUX_MIB_TLSMAX] = {};
|
||||
unsigned long buf[ARRAY_SIZE(tls_mib_list)];
|
||||
const int cnt = ARRAY_SIZE(tls_mib_list);
|
||||
struct net *net = seq->private;
|
||||
int i;
|
||||
|
||||
snmp_get_cpu_field_batch(buf, tls_mib_list, net->mib.tls_statistics);
|
||||
for (i = 0; tls_mib_list[i].name; i++)
|
||||
memset(buf, 0, sizeof(buf));
|
||||
snmp_get_cpu_field_batch_cnt(buf, tls_mib_list, cnt,
|
||||
net->mib.tls_statistics);
|
||||
for (i = 0; i < cnt; i++)
|
||||
seq_printf(seq, "%-32s\t%lu\n", tls_mib_list[i].name, buf[i]);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue