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: Tue, 2 Apr 2024 01:57:50 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Maxim Moskalets <maximmosk4@...il.com>
Cc: linux-kernel@...r.kernel.org,
	Maxim Moskalets <Maxim.Moskalets@...persky.com>
Subject: Re: [PATCH 0/8] kernel: replace seq_puts by seq_putc

On Tue, Mar 26, 2024 at 09:45:14PM +0300, Maxim Moskalets wrote:
> Using seq_putc for single characters is faster and more appropriate
> than seq_puts, since only one character is passed and there is no need
> to use a more powerful and less fast function.

Could we simply do this:

static inline void seq_puts(struct seq_file *m, const char *s)
{
	if (__builtin_constant_p(*s) && s[0] && !s[1])
		seq_putc(m, s[0]);
	else
		__seq_puts(m, s);
}

IIRC, __builtin_constant_p(*s) is true when s is a string literal.
Works for recent gcc and clang...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ