On 15 Jul 2026, at 16:43, Fei Wang via dev wrote:
> Fix a Coverity INTEGER_OVERFLOW warning in dpctl_dump_flows().
>
> The PMD ID is stored as an unsigned, where UINT32_MAX is used as a
> sentinel value (NON_PMD_CORE_ID). Avoid assigning it directly to an
> int, which may trigger an implementation-defined conversion and cause
> Coverity to report an INTEGER_OVERFLOW warning.
>
> Validate negative values explicitly before converting to unsigned,
> preserving the existing behavior while eliminating the warning.
>
> Signed-off-by: Fei Wang <[email protected]>
Hi Fei,
Thanks for the new revision. It looks like you missed the comment
about the reverse Christmas tree formatting, but I think we should
be able to make that change when the patch is committed.
With that,
Acked-by: Eelco Chaudron [email protected]
> ---
> lib/dpctl.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/dpctl.c b/lib/dpctl.c
> index 752168b5a..0cda37c06 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 in reverse christmas tree order.
> bool pmd_id_filter = false;
> int lastargc = 0;
> int error;
> @@ -1063,13 +1063,19 @@ 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;
> }
> pmd_id_filter = true;
> }
> --
> 2.55.0.windows.2
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev