Skip to contentSkip to conversation

ice: fix double dereference in TP_printk problems in ice_{rx,tx}_dim_template

PATCH In review Stefan Metzmacher 2 participants 2 messages Sep 7 – Sep 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: fix double dereference in TP_printk problems in ice_{rx,tx}_dim_template

ice_tx_dim_work and ice_rx_dim_work generate the
following: "has double dereference in TP_printk" errors:

REC->q_vector->tx.tx_ring->q_index
REC->dim->state
REC->dim->profile_ix
REC->dim->tune_state
REC->dim->steps_right
REC->dim->steps_left
REC->dim->tired

And the first one hits a WARN_ONCE()...

Fixes 3089cf6d3caa ("ice: add tracepoints")
Cc Tony Nguyen <[email protected]>
Cc Przemek Kitszel <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
---
 drivers/net/ethernet/intel/ice/ice_trace.h | 44 +++++++++++-----------
 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_trace.h +22 -22
index 4f35ef8d6b29..c641f8ce1aff 100644
@@ -63,23 +63,23 @@
 DECLARE_EVENT_CLASS(ice_rx_dim_template,
 		    TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
 		    TP_ARGS(q_vector, dim),
-		    TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector)
-				     __field(struct dim *, dim)
+		    TP_STRUCT__entry(__field(u16, q_index)
+				     __field_struct(struct dim, dim)
 				     __string(devname, q_vector->rx.rx_ring->netdev->name)),
 
-		    TP_fast_assign(__entry->q_vector = q_vector;
-				   __entry->dim = dim;
+		    TP_fast_assign(__entry->q_index = q_vector->rx.rx_ring->q_index;
+				   memcpy(&__entry->dim, dim, sizeof(__entry->dim));
 				   __assign_str(devname);),
 
 		    TP_printk("netdev: %s Rx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d",
 			      __get_str(devname),
-			      __entry->q_vector->rx.rx_ring->q_index,
-			      __entry->dim->state,
-			      __entry->dim->profile_ix,
-			      __entry->dim->tune_state,
-			      __entry->dim->steps_right,
-			      __entry->dim->steps_left,
-			      __entry->dim->tired)
+			      __entry->q_index,
+			      __entry->dim.state,
+			      __entry->dim.profile_ix,
+			      __entry->dim.tune_state,
+			      __entry->dim.steps_right,
+			      __entry->dim.steps_left,
+			      __entry->dim.tired)
 );
 
 DEFINE_EVENT(ice_rx_dim_template, ice_rx_dim_work,
@@ -90,23 +90,23 @@ DEFINE_EVENT(ice_rx_dim_template, ice_rx_dim_work,
 DECLARE_EVENT_CLASS(ice_tx_dim_template,
 		    TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
 		    TP_ARGS(q_vector, dim),
-		    TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector)
-				     __field(struct dim *, dim)
+		    TP_STRUCT__entry(__field(u16, q_index)
+				     __field_struct(struct dim, dim)
 				     __string(devname, q_vector->tx.tx_ring->netdev->name)),
 
-		    TP_fast_assign(__entry->q_vector = q_vector;
-				   __entry->dim = dim;
+		    TP_fast_assign(__entry->q_index = q_vector->tx.tx_ring->q_index;
+				   memcpy(&__entry->dim, dim, sizeof(__entry->dim));
 				   __assign_str(devname);),
 
 		    TP_printk("netdev: %s Tx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d",
 			      __get_str(devname),
-			      __entry->q_vector->tx.tx_ring->q_index,
-			      __entry->dim->state,
-			      __entry->dim->profile_ix,
-			      __entry->dim->tune_state,
-			      __entry->dim->steps_right,
-			      __entry->dim->steps_left,
-			      __entry->dim->tired)
+			      __entry->q_index,
+			      __entry->dim.state,
+			      __entry->dim.profile_ix,
+			      __entry->dim.tune_state,
+			      __entry->dim.steps_right,
+			      __entry->dim.steps_left,
+			      __entry->dim.tired)
 );
 
 DEFINE_EVENT(ice_tx_dim_template, ice_tx_dim_work,
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 10 lines · Stefan Metzmacher

ice_tx_dim_work and ice_rx_dim_work generate the
following: "has double dereference in TP_printk" errors:

REC->q_vector->tx.tx_ring->q_index
REC->dim->state
REC->dim->profile_ix
REC->dim->tune_state
REC->dim->steps_right
REC->dim->steps_left
REC->dim->tired

Thanks for the patch Stefan but Jakub has already submitted a patch [1] that's en route to fix this.

Thanks,
Tony

[1] https://lore.kernel.org/intel-wired-lan/[email protected]/T/#ma04a6a8301063209e8eae383e31293953f4eba46

Quoted 14 lines

And the first one hits a WARN_ONCE()...

Fixes 3089cf6d3caa ("ice: add tracepoints")
Cc Tony Nguyen <[email protected]>
Cc Przemek Kitszel <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>