On 5/23/24 21:11, Mike Pattrick wrote:
> When retrieving a list of features supported by a network card, return
> with an error code if the request completed without an error but the
> list contains zero entries.
> 
> In practice this should never happen, but it does contribute to a
> detection in Clang's static analyzer.
> 
> Fixes: 6c59c195266c ("netdev-linux: Use ethtool to detect offload support.")
> Signed-off-by: Mike Pattrick <[email protected]>
> ---
>  lib/netdev-linux.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 25349c605..8b855bdc4 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -2439,7 +2439,9 @@ netdev_linux_read_definitions(struct netdev_linux 
> *netdev,
>      int error = 0;
>  
>      error = netdev_linux_read_stringset_info(netdev, &len);
> -    if (error || !len) {
> +    if (!len) {
> +        return -EOPNOTSUPP;
> +    } else if (error) {
>          return error;
>      }

Hmm.  In case there is an error, we should return it.  The length
check should be secondary.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to