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: <e3b8b5d4c43d4d6d88bc8e6d516c1d41@AcuMS.aculab.com>
Date: Sun, 21 Apr 2024 17:21:32 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christophe JAILLET' <christophe.jaillet@...adoo.fr>, 'Al Viro'
	<viro@...iv.linux.org.uk>
CC: 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()

From: Christophe JAILLET
> Sent: 19 April 2024 21:38
...
> > 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?
> 
> It would also slightly change the behaviour, as only the 1st char could
> be added. Actually, it is all or nothing.

Doing:
	if (sizeof(str) == 2 && str[0])
		seq_putc(m. str[0]);
	else
		__seq_puts(m, str);
Would pick up loops that do:
	char sep[2] = "";

	for (;; sep[0] = ',') {
		...
		seq_puts(m, sep);
		...
	}
as well as seq_puts(m, "x");

Whether that is worthwhile is another matter.
But it might be used.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ