On Fri, Mar 24, 2017 at 13:04:07 +0100, Cédric Bosdonnat wrote: > Add check for more than one RTA_OIF, even though this is rather > unlikely and get rid of the buggy switch / break. > --- > src/util/virnetdevip.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-)
Making coverity happy is a weak justification.
> diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
> index c9ac6baf7..f5662413a 100644
> --- a/src/util/virnetdevip.c
> +++ b/src/util/virnetdevip.c
> @@ -556,15 +556,17 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct
> nlmsghdr *resp,
> if (resp->nlmsg_type != RTM_NEWROUTE)
> return ret;
>
> - /* Extract a few attributes */
> + /* Extract a device ID attribute */
> for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
> - switch (rta->rta_type) {
> - case RTA_OIF:
> + if (rta->rta_type == RTA_OIF) {
This removes future expandability.
> oif = *(int *)RTA_DATA(rta);
>
> + /* Should never happen: netlink message would be broken */
> + if (ifname)
> + goto error;
This is weird. I know it's in a loop, but this jumps out without
reporting an error, which would make debugging even harder than in case
of a leak.
> +
> if (!(ifname = virNetDevGetName(oif)))
> goto error;
> - break;
> }
> }
>
> --
> 2.12.0
>
> --
> libvir-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/libvir-list
signature.asc
Description: PGP signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
