qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/3] linux-user: add rtnetlink(7) support


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 1/3] linux-user: add rtnetlink(7) support
Date: Tue, 14 Jun 2016 10:34:47 +0100

On 22 May 2016 at 17:56, Laurent Vivier <address@hidden> wrote:
> rtnetlink is needed to use iproute package (ip addr, ip route)
> and dhcp client.
>
> +static abi_long target_to_host_for_each_nlmsg(struct nlmsghdr *nlh,
> +                                              size_t len,
> +                                              abi_long 
> (*target_to_host_nlmsg)
> +                                                       (struct nlmsghdr *))
> +{
> +    int ret;
> +
> +    while (len > sizeof(struct nlmsghdr)) {
> +        if (tswap32(nlh->nlmsg_len) < sizeof(struct nlmsghdr) ||
> +            tswap32(nlh->nlmsg_len) > len) {
> +            break;
> +        }
> +        tswap_nlmsghdr(nlh);
> +        switch (nlh->nlmsg_type) {
> +        case NLMSG_DONE:
> +            return 0;
> +        case NLMSG_NOOP:
> +            break;
> +        case NLMSG_ERROR:
> +        {
> +            struct nlmsgerr *e = NLMSG_DATA(nlh);
> +            e->error = tswap32(e->error);
> +            tswap_nlmsghdr(&e->msg);
> +        }
> +        default:
> +            ret = target_to_host_nlmsg(nlh);
> +            if (ret < 0) {
> +                return ret;
> +            }
> +        }

Coverity points out that the NLMSG_ERROR case falls
through into the default. Missing "break" or missing
"/* fallthrough */" comment?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]