On 13.05.2015 10:22, Dan Carpenter wrote:
> On Tue, May 12, 2015 at 10:00:13PM +0200, Mateusz Kulikowski wrote:
>> On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
>>>
>>> Which part isn't aligned?  I think they both are.
>>>
>> struct rtllib_rxb *prxb = prxbIndicateArray[j];
>>
>> struct rtllib_rxb {
>>      u8 nr_subframes;
>>      struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64];
>>      u8 dst[ETH_ALEN]; // here
>>      u8 src[ETH_ALEN]; // here
>> } __packed;
>>
>> Either I forgot alignment / packing rules or this fields are never aligned 
>> "by design".
> 
> You must have forgotten something...  Everything after the pointer is
> going to be aligned sizeof(void *).

That would be true, if structure was not __packed:

$ pahole drivers/staging/rtl8192e/rtllib.ko -C rtllib_rxb
struct rtllib_rxb {
        u8                         nr_subframes;         /*     0     1 */
        struct sk_buff *           subframes[64];        /*     1   256 */
        /* --- cacheline 4 boundary (256 bytes) was 1 bytes ago --- */
        u8                         dst[6];               /*   257     6 */
        u8                         src[6];               /*   263     6 */

        /* size: 269, cachelines: 5, members: 4 */
        /* last cacheline: 13 bytes */
};

Am I right?

Regards,
Mateusz
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to