lkml.org 
[lkml]   [2019]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 2/2] r8169: Avoid pointer aliasing
From
From: Joe Perches <joe@perches.com>
Date: Tue, 05 Feb 2019 10:42:54 -0800

> On Mon, 2019-02-04 at 19:20 -0800, David Miller wrote:
>> From: Thierry Reding <thierry.reding@gmail.com>
>> Date: Mon, 4 Feb 2019 17:42:13 +0100
>>
>> > @@ -7316,7 +7325,7 @@ static int rtl_get_ether_clk(struct rtl8169_private *tp)
>> > static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>> > {
>> > const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
>> > - u8 mac_addr[ETH_ALEN] __aligned(4) = {};
>> > + u8 mac_addr[ETH_ALEN] = {};
>> > struct rtl8169_private *tp;
>>
>> I agree with Heiner, you have to provide at least 2 byte alignment for this
>> buffer due to the reasons he stated.
>
> It's declared after a pointer so it is already is 2 byte aligned.
>
> A lot of drivers wouldn't work otherwise.

That's assuming a lot about what the compiler will do when it allocates
local variables to the stack.

I want it _explicit_.

\
 
 \ /
  Last update: 2019-02-05 20:15    [W:0.066 / U:6.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site