On Tue, Dec 6, 2011 at 11:02 AM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > On Tue, 2011-12-06 at 09:15 +0200, Eliad Peller wrote: > >> > +static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr, >> > + size_t len) >> > +{ >> > + struct ieee80211_mgmt *mgmt = (void *)hdr; >> > + >> > + if (len < 25) >> > + return false; >> >> maybe use offsetof() to make clearer? > > Hm. The problem with that is that you need > offsetof(... u.action.category ...) + 1 > still since the *offset* is 24 and the size is implicit. Going beyond > that in the offset calculation would be even stranger... I think 25 is a > sufficiently non-magic number since everybody knows 24 is the "normal" > header length, and it matches the style used in this file elsewhere. > you can do something like: #define end_offsetof(TYPE, MEMBER) offsetof(TYPE, MEMBER) + \ sizeof(((TYPE *)0)->MEMBER) but hey, whatever :) Eliad. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html