From: Eric Dumazet <eric.dumazet@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, john.r.fastabend@intel.com
Subject: Re: [PATCH net-next-2.6] net_sched: sch_mqprio: dont leak kernel memory
Date: Thu, 27 Jan 2011 08:04:03 +0100 [thread overview]
Message-ID: <1296111843.1783.130.camel@edumazet-laptop> (raw)
In-Reply-To: <1296108251.2448.183.camel@Joe-Laptop>
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.
next prev parent reply other threads:[~2011-01-27 7:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-26 17:21 [PATCH net-next-2.6] net_sched: sch_mqprio: dont leak kernel memory Eric Dumazet
2011-01-26 17:43 ` Joe Perches
2011-01-26 17:49 ` Eric Dumazet
2011-01-26 17:56 ` Joe Perches
2011-01-26 19:56 ` David Miller
2011-01-27 11:17 ` Pádraig Brady
2011-01-26 19:55 ` David Miller
2011-01-26 20:23 ` Eric Dumazet
2011-01-26 20:25 ` Eric Dumazet
2011-01-26 21:24 ` Joe Perches
2011-01-26 21:28 ` Eric Dumazet
2011-01-26 21:33 ` Joe Perches
2011-01-27 6:04 ` Joe Perches
2011-01-27 6:54 ` Changli Gao
2011-01-27 7:04 ` Eric Dumazet [this message]
2011-01-26 21:15 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296111843.1783.130.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox