Skip to contentSkip to conversation

cannot size expression - exported array in kernel

DISCUSSION Johannes Berg 3 participants 3 messages Nov 21, 2011 – Nov 24, 2011 Sparse checker

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 23 lines · Johannes Berg

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);
}

Quoted 6 lines

/*
 * 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#2 lore raw
Quoted 4 lines · Pekka Enberg

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