eventdev: fix telemetry Rx adapters stats reset
PATCH 1/1 eventdev: fix telemetry Rx adapters stats reset
Caught by covscan:
1. dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279:logical_vs_bitwise: "~(*__ctype_b_loc()[(int)*params] & 2048 /* (unsigned short)_ISdigit */)" is always 1/true regardless of the values of its operand. This occurs as the logical second operand of "||".
2. dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279: remediation:
Did you intend to use "!" rather than "~"?
While isdigit return value should be compared as an int to 0, prefer ! since all of this file uses this convention.
--- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_eth_rx_adapter.c +1 -1
@@ -3334,7 +3334,7 @@ handle_rxa_stats_reset(const char *cmd __rte_unused, {uint8_t rx_adapter_id; -if (params ==NULL ||strlen (params) ==0 || ~isdigit (*params)) +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params))return -1 ;/* Get Rx adapter ID from parameter string */
Signature · 1 line
2.23.0
Looks good, thanks for posting this change.
-Jay
Quoted 43 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, March 24, 2022 8:59 PM
To: [email protected]
Cc: [email protected]; Jayatheerthan, Jay <[email protected]>; Jerin Jacob <[email protected]>; Naga Harish K, S V <[email protected]>; Kundapura, Ganapati <[email protected]>
Subject: [PATCH] eventdev: fix telemetry Rx adapters stats resetCaught by covscan:
1.
dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279:logical_vs_bitwise: "~(*__ctype_b_loc()[(int)*params] & 2048 /* (unsigned short)_ISdigit */)" is always 1/true regardless of the values of its operand. This occurs as the logical second operand of "||".
2.dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279: remediation:
Did you intend to use "!" rather than "~"?While isdigit return value should be compared as an int to 0, prefer ! since all of this file uses this convention.
Fixes 814d01709328 ("eventdev/eth_rx: support telemetry")Signed-off-by David Marchand <[email protected]>--- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/eventdev/rte_event_eth_rx_adapter.c +1
-2@@ -3334,7 +3334,7 @@ handle_rxa_stats_reset(const char *cmd __rte_unused, {uint8_t rx_adapter_id; -if (params ==NULL ||strlen (params) ==0 || ~isdigit (*params)) +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params))return -1 ;/* Get Rx adapter ID from parameter string */ --2.23.0
Quoted 4 lines · Jay
Looks good, thanks for posting this change.
Changed the subject as: ventdev/eth_rx: fix telemetry Rx adapters stats reset and Applied to dpdk-next-eventdev/for-main. Thanks.
Quoted 49 lines
-Jay
Quoted 43 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, March 24, 2022 8:59 PM
To: [email protected]
Cc: [email protected]; Jayatheerthan, Jay <[email protected]>; Jerin Jacob <[email protected]>; Naga Harish K, S V <[email protected]>; Kundapura, Ganapati <[email protected]>
Subject: [PATCH] eventdev: fix telemetry Rx adapters stats resetCaught by covscan:
1.
dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279:logical_vs_bitwise: "~(*__ctype_b_loc()[(int)*params] & 2048 /* (unsigned short)_ISdigit */)" is always 1/true regardless of the values of its operand. This occurs as the logical second operand of "||".
2.dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279: remediation:
Did you intend to use "!" rather than "~"?While isdigit return value should be compared as an int to 0, prefer ! since all of this file uses this convention.
Fixes 814d01709328 ("eventdev/eth_rx: support telemetry")Signed-off-by David Marchand <[email protected]>--- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/eventdev/rte_event_eth_rx_adapter.c +1
-2@@ -3334,7 +3334,7 @@ handle_rxa_stats_reset(const char *cmd __rte_unused, {uint8_t rx_adapter_id; -if (params ==NULL ||strlen (params) ==0 || ~isdigit (*params)) +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params))return -1 ;/* Get Rx adapter ID from parameter string */ --2.23.0