[ovs-dev] [PATCH] lldp: Fix clang warning.

Flynn, Dennis R (Dennis) drflynn at avaya.com
Thu May 7 13:27:25 UTC 2015


Hi Joe,

Yes, over-zealous checking on my part.
Thanks for finding and fixing this.

Acked-by: Dennis Flynn <drflynn at avaya.com>

________________________________________
From: Joe Stringer [joestringer at nicira.com]
Sent: Wednesday, May 06, 2015 5:44 PM
To: Flynn, Dennis R (Dennis)
Cc: dev at openvswitch.org
Subject: Re: [PATCH] lldp: Fix clang warning.

On 6 May 2015 at 14:41, Joe Stringer <joestringer at nicira.com> wrote:
> Clang-3.7 generates warnings such as the following:
> ../lib/ovs-lldp.c:394:19: error: address of array 'hardware->h_ifname'
> will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>
> This value is fetched from a netdev, which as far as I can tell must
> always have a non-NULL name. Simplify this code.
>
> Signed-off-by: Joe Stringer <joestringer at nicira.com>
> ---
>  lib/ovs-lldp.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c
> index b2fb143..54c70c5 100644
> --- a/lib/ovs-lldp.c
> +++ b/lib/ovs-lldp.c
> @@ -391,9 +391,7 @@ update_mapping_on_lldp(struct lldp *lldp, struct lldpd_hardware *hardware,
>  {
>      struct lldpd_aa_isid_vlan_maps_tlv *lm = xzalloc(sizeof *lm);
>
> -    if (hardware->h_ifname) {
> -        VLOG_INFO("\t\t hardware->h_ifname=%s", hardware->h_ifname);
> -    }
> +    VLOG_INFO("\t\t hardware->h_ifname=%s", hardware->h_ifname);
>
>      lm->isid_vlan_data.isid = m->isid;
>      lm->isid_vlan_data.vlan = m->vlan;

Not sure if there's a bug here or if it's just over-zealous checking.

CC: Dennis Flynn.



More information about the dev mailing list