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]
Message-ID: <nycvar.YFH.7.76.1910011621240.13160@cbobk.fhfr.pm>
Date:   Tue, 1 Oct 2019 16:21:34 +0200 (CEST)
From:   Jiri Kosina <jikos@...nel.org>
To:     Colin King <colin.king@...onical.com>
cc:     Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        linux-input@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] HID: prodikeys: make array keys static const, makes
 object smaller

On Thu, 5 Sep 2019, Colin King wrote:

> From: Colin Ian King <colin.king@...onical.com>
> 
> Don't populate the array keys on the stack but instead make it
> static const. Makes the object code smaller by 166 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   18931	   5872	    480	  25283	   62c3	drivers/hid/hid-prodikeys.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   18669	   5968	    480	  25117	   621d	drivers/hid/hid-prodikeys.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/hid/hid-prodikeys.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
> index 21544ebff855..fb6841ebe4d9 100644
> --- a/drivers/hid/hid-prodikeys.c
> +++ b/drivers/hid/hid-prodikeys.c
> @@ -516,7 +516,7 @@ static void pcmidi_setup_extra_keys(
>  		MY PICTURES =>	KEY_WORDPROCESSOR
>  		MY MUSIC=>	KEY_SPREADSHEET
>  	*/
> -	unsigned int keys[] = {
> +	static const unsigned int keys[] = {
>  		KEY_FN,
>  		KEY_MESSENGER, KEY_CALENDAR,
>  		KEY_ADDRESSBOOK, KEY_DOCUMENTS,
> @@ -532,7 +532,7 @@ static void pcmidi_setup_extra_keys(
>  		0
>  	};
>  
> -	unsigned int *pkeys = &keys[0];
> +	const unsigned int *pkeys = &keys[0];
>  	unsigned short i;

Applied, thanks for the fix.

-- 
Jiri Kosina
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ