Thread (16 messages) 16 messages, 5 authors, 2011-01-27

Re: [PATCH net-next-2.6] net_sched: sch_mqprio: dont leak kernel memory

flat view

From: Eric Dumazet <hidden>
Date: 2011-01-27 07:04:10

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.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help