Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: linux-sparse@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: smatch/sparse complaints on static assertion
Date: Tue, 11 Feb 2020 17:01:45 -0800	[thread overview]
Message-ID: <23e34336-22fa-d14d-c765-877abc05df12@pensando.io> (raw)
In-Reply-To: <20200212003128.pieng2rlw7mykhvk@ltop.local>

On 2/11/20 4:31 PM, Luc Van Oostenryck wrote:
> 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

Ah, that makes sense.  Thanks.
sln

  reply	other threads:[~2020-02-12  1:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e588417e-1bf4-35e3-d8d9-9911fe29e0f5@pensando.io>
2020-02-11 17:41 ` smatch/sparse complaints on static assertion Shannon Nelson
2020-02-12  0:31   ` Luc Van Oostenryck
2020-02-12  1:01     ` Shannon Nelson [this message]
2020-02-12  0:36   ` Linus Torvalds
2020-02-12  1:05     ` Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23e34336-22fa-d14d-c765-877abc05df12@pensando.io \
    --to=snelson@pensando.io \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox