[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virnetdevtap: Don't crash on !ifname in virNetDevTapInterfaceStats



On Fri, 2018-07-13 at 11:24 +0200, Michal Privoznik wrote:
[...]
> +    if (!ifname) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Interface not found"));
> +        return -1;
> +    }

I would use something like "Interface name not provided" here,
as it would better describe the cause of the error.

[...]
>          if (ifa->ifa_addr->sa_family != AF_LINK)
>              continue;
>  
> -        if (STREQ(ifa->ifa_name, ifname)) {
> +        if (STREQ_NULLABLE(ifa->ifa_name, ifname)) {

Why is the fix different for the BSD implementation? I would
expect you to just add the same snippet as above to guard the
rest of the function from ifname being NULL...

-- 
Andrea Bolognani / Red Hat / Virtualization


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]