[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1296111843.1783.130.camel@edumazet-laptop>
Date: Thu, 27 Jan 2011 08:04:03 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
john.r.fastabend@...el.com
Subject: Re: [PATCH net-next-2.6] net_sched: sch_mqprio: dont leak kernel
memory
Le mercredi 26 janvier 2011 à 22:04 -0800, Joe Perches a écrit :
> /* MQPRIO */
> #define TC_QOPT_BITMASK 15
> #define TC_QOPT_MAX_QUEUE 16
>
> struct tc_mqprio_qopt {
> __u8 num_tc;
> __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
> __u8 hw;
> __u16 count[TC_QOPT_MAX_QUEUE];
> __u16 offset[TC_QOPT_MAX_QUEUE];
> };
>
> I believe this struct needs to be declared __packed.
>
Oh my god. Yet another ugly thing.
> It could otherwise be 24 bytes not 22.
22 ? You are kidding probably. Its 82 exactly.
Listen, I doubled check my patch, its good, while your rants are lazy.
> Or if char array declarations have a different
> alignment requirement, could be any size.
>
If if if... could could could...
> memset is better than {0}.
>
You never stop do you ?
The bigger object is u16, therefore alignof() is 2, not 4
No ABI requires a short (u16) is aligned on 4 byte boundary.
If you find a compiler not respecting this, you can bet linux wont run
at all if compiled with it. mqprio 'potential 2 bytes leak' will hardly
be a problem.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists