mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
sctp: 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: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Acked-by: Xin Long <lucien.xin@gmail.com> Link: https://patch.msgid.link/20250905165813.1470708-7-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
35cb2da0ab
commit
52a33cae6a
|
|
@ -52,21 +52,21 @@ static const struct snmp_mib sctp_snmp_list[] = {
|
||||||
SNMP_MIB_ITEM("SctpInPktBacklog", SCTP_MIB_IN_PKT_BACKLOG),
|
SNMP_MIB_ITEM("SctpInPktBacklog", SCTP_MIB_IN_PKT_BACKLOG),
|
||||||
SNMP_MIB_ITEM("SctpInPktDiscards", SCTP_MIB_IN_PKT_DISCARDS),
|
SNMP_MIB_ITEM("SctpInPktDiscards", SCTP_MIB_IN_PKT_DISCARDS),
|
||||||
SNMP_MIB_ITEM("SctpInDataChunkDiscards", SCTP_MIB_IN_DATA_CHUNK_DISCARDS),
|
SNMP_MIB_ITEM("SctpInDataChunkDiscards", SCTP_MIB_IN_DATA_CHUNK_DISCARDS),
|
||||||
SNMP_MIB_SENTINEL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
|
/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
|
||||||
static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
|
static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
|
||||||
{
|
{
|
||||||
unsigned long buff[SCTP_MIB_MAX];
|
unsigned long buff[ARRAY_SIZE(sctp_snmp_list)];
|
||||||
|
const int cnt = ARRAY_SIZE(sctp_snmp_list);
|
||||||
struct net *net = seq->private;
|
struct net *net = seq->private;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(buff, 0, sizeof(unsigned long) * SCTP_MIB_MAX);
|
memset(buff, 0, sizeof(buff));
|
||||||
|
|
||||||
snmp_get_cpu_field_batch(buff, sctp_snmp_list,
|
snmp_get_cpu_field_batch_cnt(buff, sctp_snmp_list, cnt,
|
||||||
net->sctp.sctp_statistics);
|
net->sctp.sctp_statistics);
|
||||||
for (i = 0; sctp_snmp_list[i].name; i++)
|
for (i = 0; i < cnt; i++)
|
||||||
seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
|
seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
|
||||||
buff[i]);
|
buff[i]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user