eventdev: fix telemetry Rx adapters stats reset

Message ID 20220324152830.28155-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series eventdev: fix telemetry Rx adapters stats reset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional fail Functional Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

David Marchand March 24, 2022, 3:28 p.m. UTC
  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.

Fixes: 814d01709328 ("eventdev/eth_rx: support telemetry")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jayatheerthan, Jay March 25, 2022, 9:32 a.m. UTC | #1
Looks good, thanks for posting this change.

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

-Jay



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, March 24, 2022 8:59 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga Harish K, S V
> <s.v.naga.harish.k@intel.com>; Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Subject: [PATCH] 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.
> 
> Fixes: 814d01709328 ("eventdev/eth_rx: support telemetry")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index ff83ce8b67..bf8741d2ea 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -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
  
Jerin Jacob May 10, 2022, 2:35 p.m. UTC | #2
On Fri, Mar 25, 2022 at 3:02 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> Looks good, thanks for posting this change.
>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

Changed the subject as: ventdev/eth_rx: fix telemetry Rx adapters stats reset
and  Applied to dpdk-next-eventdev/for-main. Thanks.

>
> -Jay
>
>
>
> > -----Original Message-----
> > From: David Marchand <david.marchand@redhat.com>
> > Sent: Thursday, March 24, 2022 8:59 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com>; Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Subject: [PATCH] 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.
> >
> > Fixes: 814d01709328 ("eventdev/eth_rx: support telemetry")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index ff83ce8b67..bf8741d2ea 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -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
>
  

Patch

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index ff83ce8b67..bf8741d2ea 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -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 */