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: <20240419213240.GE2118490@ZenIV>
Date: Fri, 19 Apr 2024 22:32:40 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: David Laight <David.Laight@...lab.com>,
	Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH] seq_file: Optimize seq_puts()

On Fri, Apr 19, 2024 at 10:38:15PM +0200, Christophe JAILLET wrote:
> Le 16/04/2024 à 22:56, David Laight a écrit :
> > From: Al Viro
> > > Sent: 15 April 2024 22:01
> > ...
> > > No need to make it a macro, actually.  And I would suggest going
> > > a bit further:
> > > 
> > > static inline void seq_puts(struct seq_file *m, const char *s)
> > 
> > That probably needs to be 'always_inline'.
> > 
> > > {
> > > 	if (!__builtin_constant_p(*s))
> > > 		__seq_puts(m, s);
> > > 	else if (s[0] && !s[1])
> > > 		seq_putc(m, s[0]);
> > > 	else
> > > 		seq_write(m, s, __builtin_strlen(s));
> > > }
> > 
> > You missed seq_puts(m, "");
> > 
> > I did wonder about checking sizeof(s) <= 2 in the #define version.
> 
> git grep seq_puts.*\"[^\\].\" | wc -l
> 77
> 
> What would you do in this case?
> 2 seq_putc() in order to save a memcpy(..., 2), that's it?

Not a damn thing - just have it call seq_write().  Note that
	if (s[0] && !s[1])
which triggers only on single-character strings.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ