All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support
@ 2022-06-28 10:19 Petr Machata
  2022-07-01 14:42 ` David Ahern
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Machata @ 2022-06-28 10:19 UTC (permalink / raw)
  To: netdev
  Cc: David Ahern, Stephen Hemminger, Petr Machata, Tariq Toukan, Itay Aveksis

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(-)

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 */
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support
  2022-06-28 10:19 [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support Petr Machata
@ 2022-07-01 14:42 ` David Ahern
  2022-07-06 12:42   ` Petr Machata
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2022-07-01 14:42 UTC (permalink / raw)
  To: Petr Machata, netdev; +Cc: Stephen Hemminger, Tariq Toukan, Itay Aveksis

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support
  2022-07-01 14:42 ` David Ahern
@ 2022-07-06 12:42   ` Petr Machata
  2022-07-06 14:52     ` David Ahern
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Machata @ 2022-07-06 12:42 UTC (permalink / raw)
  To: David Ahern
  Cc: Petr Machata, netdev, Stephen Hemminger, Tariq Toukan, Itay Aveksis


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support
  2022-07-06 12:42   ` Petr Machata
@ 2022-07-06 14:52     ` David Ahern
  0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2022-07-06 14:52 UTC (permalink / raw)
  To: Petr Machata; +Cc: netdev, Stephen Hemminger, Tariq Toukan, Itay Aveksis

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-06 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 10:19 [PATCH iproute2-next v2] ip: Fix rx_otherhost_dropped support Petr Machata
2022-07-01 14:42 ` David Ahern
2022-07-06 12:42   ` Petr Machata
2022-07-06 14:52     ` David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.