linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cannot size expression - exported array in kernel
@ 2011-11-21 10:06 Johannes Berg
  2011-11-24  7:29 ` Pekka Enberg
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2011-11-21 10:06 UTC (permalink / raw)
  To: linux-sparse

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
 */



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cannot size expression - exported array in kernel
  2011-11-21 10:06 cannot size expression - exported array in kernel Johannes Berg
@ 2011-11-24  7:29 ` Pekka Enberg
  2011-11-24  7:53   ` Christopher Li
  0 siblings, 1 reply; 3+ messages in thread
From: Pekka Enberg @ 2011-11-24  7:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-sparse, Linus Torvalds, Christopher Li

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cannot size expression - exported array in kernel
  2011-11-24  7:29 ` Pekka Enberg
@ 2011-11-24  7:53   ` Christopher Li
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Li @ 2011-11-24  7:53 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Johannes Berg, linux-sparse, Linus Torvalds

On Wed, Nov 23, 2011 at 11:29 PM, Pekka Enberg <penberg@kernel.org> wrote:
> 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.

I will add that to a validation test case and take a closer look.

Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-24  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 10:06 cannot size expression - exported array in kernel Johannes Berg
2011-11-24  7:29 ` Pekka Enberg
2011-11-24  7:53   ` Christopher Li

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).