On 10/10/2025 17:09, Eelco Chaudron via dev wrote:
> Free the error string returned by str_to_u8() in set_tunnel_config().
> While at it, also add a proper error message for this error case.
>
> Fixes: ebe0e518b048 ("tunnel: Bareudp Tunnel Support.")
> Signed-off-by: Eelco Chaudron <[email protected]>
> ---
> lib/netdev-vport.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index ed67b509d..d11269d00 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -813,9 +813,13 @@ set_tunnel_config(struct netdev *dev_, const struct smap
> *args, char **errp)
> tnl_cfg.exts |= (1 << OVS_BAREUDP_EXT_MULTIPROTO_MODE);
> } else {
> uint16_t payload_ethertype;
> + char *error = str_to_u16(node->value, "payload_type",
> + &payload_ethertype);
Alternative would be to use str_to_uint() directly, but there'd be a bit
of messing around with bounds checks and types, so it's probably more
readable as you have it.
Acked-by: Kevin Traynor <[email protected]>
>
> - if (str_to_u16(node->value, "payload_type",
> - &payload_ethertype)) {
> + if (error) {
> + free(error);
> + ds_put_format(&errors, "%s: bad %s 'payload_type'\n",
> + name, node->value);
> err = EINVAL;
> goto out;
> }
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev