joerg added a comment.

The following is from my comment on the original commit.

I'm trying this patch now. Two instances here show false positives. Some
others are misuse/overuse of __packed, it is time consuming to check all
of them.

- sbin/route

https://nxr.netbsd.org/xref/src/sbin/route/route.c#1009 triggers the warning:

  union mpls_shim *ms = &su->smpls.smpls_addr;

where su is defined as:

  union sockunion {
      ...
      struct  sockaddr_mpls smpls;
  };

and sockaddr_mpls in turn is 
https://nxr.netbsd.org/xref/src/sys/netmpls/mpls.h#66

  struct sockaddr_mpls {
      uint8_t smpls_len;
      uint8_t smpls_family;
      uint8_t smpls_pad[2];
      union mpls_shim smpls_addr;
  } __packed;

smpls_addr is a union of a uint32_t and matching bit field. The alignment of 
sockunion and the explicit padding ensures that all fields can be accessed 
correctly.

- sbin/ifconfig

Member access is https://nxr.netbsd.org/xref/src/sbin/ifconfig/ieee80211.c#969
The macro is defined at 
https://nxr.netbsd.org/xref/src/sbin/ifconfig/ieee80211.c#928

Most importantly, this effective casts immediately to (unsigned) char and 
therefore doesn't care about any misalignment.


https://reviews.llvm.org/D23657



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to