On Thu, Aug 28, 2008 at 9:38 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
Hm, and this is exactly the case for the "do_not_encrypt" field of skbuff:
#ifdef CONFIG_IPV6_NDISC_NODETYPE
__u8 ndisc_nodetype:2;
#endif
#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
__u8 do_not_encrypt:1;
#endif
So we have no way to know where or how big the filler should be. This is
why the simple patch above is not sufficient.
Alexey: I have a modified proposal with slightly different syntax for
DEFINE_BITFIELD. Can you say whether this is acceptable or not? Please
see this short mockup example:
<--- cut --->
#include <stdint.h>
#include <string.h>
#define DEFINE_BITFIELD(name, fields...) \
union { \
struct fields name; \
struct fields; \
};
#define KMEMCHECK_ANNOTATE_BITFIELD(bitfield) \
do { \
memset(&(bitfield), 0, sizeof(bitfield)); \
} while(0)
struct skbuff {
DEFINE_BITFIELD(flags1, {
uint8_t pkt_type:3,
fclone:2,
ipvs_property:1,
peeked:1,
nf_trace:1;
uint16_t protocol;
});
DEFINE_BITFIELD(flags2, {
#ifdef CONFIG_IPV6_NDISC_NODETYPE
uint8_t ndisc_nodetype:2;
#endif
#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
uint8_t do_not_encrypt:1;
#endif
});
};
void __alloc_skb(struct skbuff *skb)
{
KMEMCHECK_ANNOTATE_BITFIELD(skb->flags1);
KMEMCHECK_ANNOTATE_BITFIELD(skb->flags2);
}
<--- cut --->
Thanks,
Vegard
--