Re: smatch/sparse complaints on static assertion

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

 



On Tue, Feb 11, 2020 at 09:41:05AM -0800, Shannon Nelson wrote:
> Hi All,
> 
> I'm getting complaints from smatch on the ionic network driver's static
> assertions and am not sure why it was complaining.  Dan Carpenter suggested
> this might be an issue in sparse with how it is calculating the sizes of the
> unions.
> 
> I ran this at the top of a pretty recent net-next tree
> (v5.5-rc7-1839-g8192c36)
> $ ../smatch/smatch_scripts/kchecker drivers/net/ethernet/pensando/ionic/
> 
> And got several copies of this:
> 
> drivers/net/ethernet/pensando/ionic/ionic_dev.h:38:1: error: static
> assertion failed: "sizeof(union ionic_dev_regs) == 4096"

...
 
> These static assertion lines have been fine up until now and I'm pretty sure
> they are correct.
> 
> Has this issue been seen elsewhere?  Or is there something I can do in our
> code to get rid of the complaints?

This is caused by the packing of the structs. It's using
	#pragma pack(push, 1) / #pragma pack(pop)
which is not supported by Sparse. Packing via __attribute__((packed))
is incomplete but the pragmas are currently completly ignored.

-- Luc Van Oostenryck



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux