[libvirt] [PATCH] network: selectively disable -Wcast-align in virNetDevParseDadStatus

Jim Fehlig jfehlig at suse.com
Wed Dec 2 00:49:10 UTC 2015


On 11/30/2015 09:18 PM, Jim Fehlig wrote:
> On 11/26/2015 08:10 AM, Ian Campbell wrote:
>> Commit 0f7436ca54c9 "network: wait for DAD to finish for bridge IPv6 addresses"
>> results in:
>>
>>  CC     util/libvirt_util_la-virnetdevmacvlan.lo
>> util/virnetdev.c: In function 'virNetDevParseDadStatus':
>> util/virnetdev.c:1319:188: error: cast increases required alignment of target type [-Werror=cast-align]
>> util/virnetdev.c:1332:41: error: cast increases required alignment of target type [-Werror=cast-align]
>> util/virnetdev.c:1334:92: error: cast increases required alignment of target type [-Werror=cast-align]
>> cc1: all warnings being treated as errors
>>
>> on at least ARM platforms.
> Thanks for looking into this issue Ian.
>
>> The three macros involved (NLMSG_NEXT, IFA_RTA and RTA_NEXT) all appear to
>> correctly take care of alignment, therefore suppress Wcast-align around their
>> uses.
> Indeed those macros seem to handle alignment, even on one of my older machines
> with 2.6 kernel headers. IMO this falls under the "difficult or impossible to
> address" scenarios that Daniel mentioned when introducing the VIR_WARNINGS_*
> macros via commit e57aaa6f. Adding Daniel to cc for a sanity check of my weak ACK.

Looks like I forgot to actually add Daniel to the cc list. Doing so now...

>
> Regards,
> Jim
>
>> Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
>> Cc: Maxim Perevedentsev <mperevedentsev at virtuozzo.com>
>> Cc: Laine Stump <laine at laine.org>
>> Cc: Dario Faggioli <dario.faggioli at citrix.com>
>> Cc: Jim Fehlig <jfehlig at suse.com>
>> ---
>>  src/util/virnetdev.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
>> index ade9afa..0bc809e 100644
>> --- a/src/util/virnetdev.c
>> +++ b/src/util/virnetdev.c
>> @@ -1316,7 +1316,10 @@ virNetDevParseDadStatus(struct nlmsghdr *nlh, int len,
>>      struct rtattr *rtattr_ptr;
>>      size_t i;
>>      struct in6_addr *addr;
>> +
>> +    VIR_WARNINGS_NO_CAST_ALIGN
>>      for (; NLMSG_OK(nlh, len); nlh = NLMSG_NEXT(nlh, len)) {
>> +    VIR_WARNINGS_RESET
>>          if (NLMSG_PAYLOAD(nlh, 0) < sizeof(struct ifaddrmsg)) {
>>              /* Message without payload is the last one. */
>>              break;
>> @@ -1329,9 +1332,11 @@ virNetDevParseDadStatus(struct nlmsghdr *nlh, int len,
>>          }
>>  
>>          ifaddrmsg_len = IFA_PAYLOAD(nlh);
>> +        VIR_WARNINGS_NO_CAST_ALIGN
>>          rtattr_ptr = (struct rtattr *) IFA_RTA(ifaddrmsg_ptr);
>>          for (; RTA_OK(rtattr_ptr, ifaddrmsg_len);
>>              rtattr_ptr = RTA_NEXT(rtattr_ptr, ifaddrmsg_len)) {
>> +            VIR_WARNINGS_RESET
>>              if (RTA_PAYLOAD(rtattr_ptr) != sizeof(struct in6_addr)) {
>>                  /* No address: ignore. */
>>                  continue;
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>




More information about the libvir-list mailing list