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: <1399502135.6345.8.camel@joe-AO725>
Date:	Wed, 07 May 2014 15:35:35 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Fabian Frederick <fabf@...net.be>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Paul Gortmaker <paul.gortmaker@...driver.com>
Subject: Re: [PATCH 1/1] kernel/profile.c: use static const char instead of
 static char

On Wed, 2014-05-07 at 15:30 -0700, Andrew Morton wrote:
> On Wed, 7 May 2014 22:35:08 +0200 Fabian Frederick <fabf@...net.be> wrote:
> > schedstr, sleepstr and kvmstr are only used in strcmp & strlen
[]
> > +++ b/kernel/profile.c
> > @@ -52,9 +52,9 @@ static DEFINE_MUTEX(profile_flip_mutex);
> >  
> >  int profile_setup(char *str)
> >  {
> > -	static char schedstr[] = "schedule";
> > -	static char sleepstr[] = "sleep";
> > -	static char kvmstr[] = "kvm";
> > +	static const char schedstr[] = "schedule";
> > +	static const char sleepstr[] = "sleep";
> > +	static const char kvmstr[] = "kvm";
> >  	int par;
> >  
> 
> I'd expect this to either make no change or to make text larger and
> data smaller.
> 
> In fact,
> 
>    text    data     bss     dec     hex filename
>    7631     811    3016   11458    2cc2 kernel/profile.o-before
>    7520     779    3016   11315    2c33 kernel/profile.o-after
> 
> Both text and data got smaller and the total reduction was a whopping
> 143 bytes.   Weirdness.

Now there's no code required to initialize/memcpy
the strings every function invocation.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ