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]
Message-ID: <9229927125ab9d36bd38cf0c20fb5dfb45802fcb.camel@perches.com>
Date:   Tue, 28 Aug 2018 11:24:34 -0700
From:   Joe Perches <joe@...ches.com>
To:     Alexey Dobriyan <adobriyan@...il.com>, akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/13] seq_file: rewrite seq_puts() in terms of
 seq_write()

On Tue, 2018-08-28 at 02:14 +0300, Alexey Dobriyan wrote:
> Space savings -- 42 bytes!
> 
> 	seq_puts	71      29     [-42]
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> ---
>  fs/seq_file.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/fs/seq_file.c b/fs/seq_file.c
> index 1dea7a8a5255..0c282a88a896 100644
> --- a/fs/seq_file.c
> +++ b/fs/seq_file.c
> @@ -653,14 +653,7 @@ EXPORT_SYMBOL(seq_putc);
>  
>  void seq_puts(struct seq_file *m, const char *s)
>  {
> -	int len = strlen(s);
> -
> -	if (m->count + len >= m->size) {
> -		seq_set_overflow(m);
> -		return;
> -	}
> -	memcpy(m->buf + m->count, s, len);
> -	m->count += len;
> +	seq_write(m, s, strlen(s));
>  }
>  EXPORT_SYMBOL(seq_puts);
>  

If execution speed is really an issue, as
almost all of the uses are for const strings,
why not use a #define and avoid the runtime
cost of strlen where possible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ