On Mon, 2007-10-01 at 06:41 -0400, Robert P. J. Day wrote: <snip> (Code snippets in my email are based on 2.6.22.6) > so ELEMCOUNT() is clearly just an alternative to the more common > ARRAY_SIZE() macro. but calling the macro SCTP_CHUNKMAP_IS_CLEAR() > pretty clearly assumes that you can determine the array size of the > macro parameter "chunkmap". however, from the source file > net/netfilter/xt_sctp.c, we have: > ... > static inline bool > match_packet(const struct sk_buff *skb, > unsigned int offset, > const u_int32_t *chunkmap, <----- only a *pointer* > ... This is called from one place - net/netfilter/xt_sctp.c in match(): ... && SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t), info->chunkmap, info->chunk_match_type, info->flag_info, info->flag_count, hotdrop), ... At the start of the function, we have: const struct xt_sctp_info *info = matchinfo; In that struct, chunkmap is declared as: u_int32_t chunkmap[256 / sizeof (u_int32_t)]; > switch (chunk_match_type) { > case SCTP_CHUNK_MATCH_ALL: > return SCTP_CHUNKMAP_IS_CLEAR(chunkmap); > ... > > i don't see how you can reasonably call the macro > SCTP_CHUNKMAP_IS_CLEAR() with a *pointer* to an array and expect that > macro to be able to determine the "size" of that array. AFAIK, > wouldn't you just get the answer "1" as the alleged size? So while it's a pointer there, it was actually declared as an array. Personally I don't like this kind of thing. I'd rather have an array_size variable in the struct, but maybe that's just me. > or is it a bad idea that i've been up all night again? Get some sleep :-P > rday Avishay -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ