aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2022-06-28 12:19:11 +0200
committerDavid Ahern <dsahern@kernel.org>2022-07-06 08:47:58 -0600
commitce4807f4437a95ed38290e465148a28e28e914b0 (patch)
tree67cc7f5157f5f63d4231080c17c88b342eef7e98
parente903fdfb560ec3ae44df788f1878d0c81b2d5327 (diff)
downloadiproute2-ce4807f4437a95ed38290e465148a28e28e914b0.tar.gz
ip: Fix rx_otherhost_dropped support
The commit cited below added a new column to print_stats64(). However it then updated only one size_columns() call site, neglecting to update the remaining three. As a result, in those not-updated invocations, size_columns() now accesses a vararg argument that is not being passed, which is undefined behavior. Fixes: cebf67a35d8a ("show rx_otherehost_dropped stat in ip link show") CC: Tariq Toukan <tariqt@nvidia.com> CC: Itay Aveksis <itayav@nvidia.com> Signed-off-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
-rw-r--r--ip/ipaddress.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5387b6a6b..610bdbde3 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -775,10 +775,12 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
if (what)
close_json_object();
} else {
+ uint64_t zero64 = 0;
+
size_columns(cols, ARRAY_SIZE(cols),
s->rx_bytes, s->rx_packets, s->rx_errors,
s->rx_dropped, s->rx_missed_errors,
- s->multicast, s->rx_compressed);
+ s->multicast, s->rx_compressed, zero64);
if (show_stats > 1)
size_columns(cols, ARRAY_SIZE(cols), 0,
s->rx_length_errors, s->rx_crc_errors,
@@ -788,7 +790,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
size_columns(cols, ARRAY_SIZE(cols),
s->tx_bytes, s->tx_packets, s->tx_errors,
s->tx_dropped, s->tx_carrier_errors,
- s->collisions, s->tx_compressed);
+ s->collisions, s->tx_compressed, zero64);
if (show_stats > 1) {
uint64_t cc = carrier_changes ?
rta_getattr_u32(carrier_changes) : 0;
@@ -796,7 +798,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
size_columns(cols, ARRAY_SIZE(cols), 0, 0,
s->tx_aborted_errors, s->tx_fifo_errors,
s->tx_window_errors,
- s->tx_heartbeat_errors, cc);
+ s->tx_heartbeat_errors, cc, zero64);
}
/* RX stats */