linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-sparse@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christopher Li <sparse@chrisli.org>
Subject: Re: cannot size expression - exported array in kernel
Date: Thu, 24 Nov 2011 09:29:54 +0200	[thread overview]
Message-ID: <CAOJsxLEgV4v0rVPb1O63T-p+Nj++kkE4dh2L3k_a2XGqptnVeQ@mail.gmail.com> (raw)
In-Reply-To: <1321870017.3999.31.camel@jlt3.sipsolutions.net>

On Mon, Nov 21, 2011 at 12:06 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Here's some code from net/wireless/util.c, expressed as a test case. I
> have no idea how to fix it. The actual output is:
>
> +sizeof-external.c:11:16: error: cannot size expression
>
> while none is expected.
>
> johannes
>
> /***** begin file validation/sizeof-external.c **** */
> /* #include file that declares it */
> extern const unsigned char bridge_tunnel_header[6];
>
> /* define it */
> const unsigned char bridge_tunnel_header[] = { 1, 2, 3, 4, 5, 6 };
> /* EXPORT_SYMBOL it */
> extern typeof(bridge_tunnel_header) bridge_tunnel_header; /* ... */
>
> static int bth_size(void)
> {
>        return sizeof(bridge_tunnel_header);
> }
>
> /*
>  * check-name: Check sizeof(kernel_exported_external_variable)
>  *
>  * check-error-start
>  * check-error-end
>  */.

I'm not really an expert in the sparse front-end either. Looking at
your test case, evaluate_sizeof() returns -1 which suggests
examine_symbol_type() doesn't handle typeof(bridge_tunnel_header)
properly.

                                Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-11-24  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 10:06 cannot size expression - exported array in kernel Johannes Berg
2011-11-24  7:29 ` Pekka Enberg [this message]
2011-11-24  7:53   ` Christopher Li

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=CAOJsxLEgV4v0rVPb1O63T-p+Nj++kkE4dh2L3k_a2XGqptnVeQ@mail.gmail.com \
    --to=penberg@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).