lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 5 Nov 2020 14:54:21 +0000
From:   Robin Murphy <robin.murphy@....com>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>
Cc:     "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Heiko Stuebner <heiko@...ech.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>
Subject: Re: [PATCH] pinctrl: Remove hole in pinctrl_gpio_range

On 2020-11-05 13:57, Linus Walleij wrote:
> On Wed, Oct 28, 2020 at 3:51 PM Geert Uytterhoeven
> <geert+renesas@...der.be> wrote:
> 
>> On 64-bit platforms, pointer size and alignment are 64-bit, hence two
>> 4-byte holes are present before the pins and gc members of the
>> pinctrl_gpio_range structure.  Get rid of these holes by moving the
>> pins pointer.
>>
>> This reduces kernel size of an arm64 Rockchip kernel by ca. 512 bytes.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
>> ---
>> Compile-tested only (arm/multi_v7_defconfig and arm64/defconfig).
> 
> Patch applied.
> 
> Do you think it'd be worth it to add a check to checkpatch to suggest
> to move pointers toward the end of any struct?

For a general rule, I thought that ordering struct members largest-first 
was the conventional wisdom, since that way no sensible compiler would 
add padding between any members, only at the end?

That said, the trouble with any checkpatch rule is that people will 
inevitably try to apply it indiscriminately. With structure layout, that 
could often end up hurting readability and/or performance (via cache 
effects), while in many cases making no actual difference to the overall 
size anyway.

Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ