Message ID | 4148bef3a4e4f259aa9fa7936062a4416a035fec.1656411498.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | David Ahern |
Headers | show |
Series | [iproute2-next,v2] ip: Fix rx_otherhost_dropped support | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On 6/28/22 4:19 AM, Petr Machata wrote: > 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> > --- > > Notes: > v2: > - Adjust to changes in the "32-bit quantity" patch > - Tweak the commit message for clarity > > ip/ipaddress.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > I merged main into next and now this one needs to be rebased.
David Ahern <dsahern@gmail.com> writes: > On 6/28/22 4:19 AM, Petr Machata wrote: >> 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> >> --- >> >> Notes: >> v2: >> - Adjust to changes in the "32-bit quantity" patch >> - Tweak the commit message for clarity >> >> ip/ipaddress.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> > > I merged main into next and now this one needs to be rebased. The issue is that this depends on 329fda186156 ("ip: Fix size_columns() invocation that passes a 32-bit quantity"), which got to net only yesterday. When it's merged to next, this patch should apply cleanly.
On 7/6/22 6:42 AM, Petr Machata wrote: > > David Ahern <dsahern@gmail.com> writes: > >> On 6/28/22 4:19 AM, Petr Machata wrote: >>> 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> >>> --- >>> >>> Notes: >>> v2: >>> - Adjust to changes in the "32-bit quantity" patch >>> - Tweak the commit message for clarity >>> >>> ip/ipaddress.c | 8 +++++--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >> >> I merged main into next and now this one needs to be rebased. > > The issue is that this depends on 329fda186156 ("ip: Fix size_columns() > invocation that passes a 32-bit quantity"), which got to net only > yesterday. When it's merged to next, this patch should apply cleanly. ah, merged again and applied.
diff --git a/ip/ipaddress.c b/ip/ipaddress.c index a288341c..8a78d02c 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -770,10 +770,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, @@ -782,7 +784,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; @@ -790,7 +792,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 */
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> --- Notes: v2: - Adjust to changes in the "32-bit quantity" patch - Tweak the commit message for clarity ip/ipaddress.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)