On 9 Jul 2026, at 15:46, Fei Wang via dev wrote:
Hi Fei,
Thanks for following up. Some small formatting comments below. In
general it looks good.
//Eelco
> Fix a Coverity INTEGER_OVERFLOW warning in dpctl_dump_flows().
>
> The PMD ID is stored as a uint32_t, where UINT32_MAX is used as a
> sentinel value. Avoid assigning it directly to an int, which may trigger
> an implementation-defined conversion and cause Coverity to report an
> INTEGER_OVERFLOW warning.
So this might need a small rewrite, something like;
The PMD ID is stored as an unsigned, where UINT32_MAX is used as a
sentinel value (NON_PMD_CORE_ID)....
> Keep the variable type consistent with the original data or perform an
> explicit validity check before conversion to eliminate the warning while
> preserving the existing behavior.
>
> Signed-off-by: Fei Wang <[email protected]>
> ---
> lib/dpctl.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/lib/dpctl.c b/lib/dpctl.c
> index 752168b5a..9108211bb 100644
> --- a/lib/dpctl.c
> +++ b/lib/dpctl.c
> @@ -1044,7 +1044,7 @@ dpctl_dump_flows(int argc, const char *argv[], struct
> dpctl_params *dpctl_p)
> struct dpif_flow_dump_thread *flow_dump_thread;
> struct dpif_flow_dump *flow_dump;
> struct dpif_flow f;
> - int pmd_id = PMD_ID_NULL;
> + unsigned pmd_id = PMD_ID_NULL;
This should be using reverse Christmas tree ordering.
> bool pmd_id_filter = false;
> int lastargc = 0;
> int error;
> @@ -1063,13 +1063,20 @@ dpctl_dump_flows(int argc, const char *argv[], struct
> dpctl_params *dpctl_p)
> }
> types_list = xstrdup(argv[--argc] + 5);
> } else if (!strncmp(argv[argc - 1], "pmd=", 4)) {
> - if (!ovs_scan(argv[--argc], "pmd=%d", &pmd_id)) {
> + int pmd_id_arg;
> +
> + if (!ovs_scan(argv[--argc], "pmd=%d", &pmd_id_arg)) {
> error = EINVAL;
> goto out_free;
> }
>
> - if (pmd_id == -1) {
> + if (pmd_id_arg == -1) {
> pmd_id = NON_PMD_CORE_ID;
> + } else if (pmd_id_arg < 0) {
> + error = EINVAL;
> + goto out_free;
> + } else {
> + pmd_id = pmd_id_arg;
Indentation is off here.
> }
> pmd_id_filter = true;
> }
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev