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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 5 May 2021 20:49:51 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        "James E . J . Bottomley" <jejb@...ux.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: ufs: ufs-exynos: make a const array static, makes
 object smaller

On 05/05/2021 20:41, Krzysztof Kozlowski wrote:
> On 05/05/2021 15:01, Colin King wrote:
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> Don't populate the const array granularity_tbl on the stack but instead it
>> static. Makes the object code smaller by 190 bytes:
>>
>> Before:
>>    text    data     bss     dec     hex filename
>>   25563    6908       0   32471    7ed7 ./drivers/scsi/ufs/ufs-exynos.o
>>
>> After:
>>    text    data     bss     dec     hex filename
>>   25213    7068       0   32281    7e19 ./drivers/scsi/ufs/ufs-exynos.o
>>
>> (gcc version 10.3.0)
> 
> I am not sure what's the benefit here - you moved the code from text to
> data. In total you decreased the size for this compilation settings
> (e.g. compiler + optimizations) but that might not be always true, right?

It is a marginal saving, but for arrays this size it makes sense to not
have to populate the data into the stack before using it and then
discarding it. This change essentially replaces quite a lot of
instructions that put the data onto the stack so I think it's worth while.

> 
> This has effect on the code readability - line is longer and reader
> would think "why this was made static since it is simple one-time const?".
>

Not sure how to respond to this. If they wonder why it is static const
and don't know why then one would hope they look it up in K&R and
familiarize themselves with C.  It's not so subtle.

Colin
> 
> Best regards,
> Krzysztof
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ