On Tue, May 19, 2026 at 9:20 AM Timothy Redaelli via dev <
[email protected]> wrote:

> The condition (flow->actions || flow->actions_len) allows
> flow->actions to be NULL when flow->actions_len is nonzero,
> which would pass NULL to nl_msg_put_unspec().
>
> Simplify the guard to just check flow->actions, since a non-NULL
> actions pointer is the meaningful condition for serialization, and
> nl_msg_put_unspec already handles actions_len == 0 correctly.
>
> Found by OpenScanHub Coverity (FORWARD_NULL).
> Signed-off-by: Timothy Redaelli <[email protected]>
> ---
>  lib/dpif-netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
> index f22a87934..7bd9449a8 100644
> --- a/lib/dpif-netlink.c
> +++ b/lib/dpif-netlink.c
> @@ -4712,7 +4712,7 @@ dpif_netlink_flow_to_ofpbuf(const struct
> dpif_netlink_flow *flow,
>              put_exclude_packet_type(buf, OVS_FLOW_ATTR_MASK, flow->mask,
>                                             flow->mask_len);
>          }
> -        if (flow->actions || flow->actions_len) {
>

Should this be "flow->actions && flow->actions_len" instead?

-M


> +        if (flow->actions) {
>              nl_msg_put_unspec(buf, OVS_FLOW_ATTR_ACTIONS,
>                                flow->actions, flow->actions_len);
>          }
> --
> 2.54.0
>
> _______________________________________________
> 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

Reply via email to