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: <20251218194957.GZ7725@frogsfrogsfrogs>
Date: Thu, 18 Dec 2025 11:49:57 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: brauner@...nel.org, linux-ext4@...r.kernel.org,
	linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/4] fs: send uevents for filesystem mount events

On Wed, Dec 17, 2025 at 09:26:41PM -0800, Christoph Hellwig wrote:
> > +#define ADVANCE_ENV(envp, buf, buflen, written) \
> > +	do { \
> > +		ssize_t __written = (written); \
> > +\
> > +		WARN_ON((buflen) < (__written) + 1); \
> > +		*(envp) = (buf); \
> > +		(envp)++; \
> > +		(buf) += (__written) + 1; \
> > +		(buflen) -= (__written) + 1; \
> > +	} while (0)
> 
> Any reason this is a macro vs an (inline?) function?  Looking at this a
> bit more, could this simply use a seq_buf?

I'll change it to something like this:

	seq_buf_init(&sbuf, buf, buflen);
	envp = env;

	/*
	 * Add a second null terminator on the end so the next printf can start
	 * printing at the second null terminator.
	 */
	seq_buf_get_buf(&sbuf, envp++);
	seq_buf_printf(&sbuf, "TYPE=filesystem");
	seq_buf_putc(&sbuf, 0);

	seq_buf_get_buf(&sbuf, envp++);
	seq_buf_printf(&sbuf, "SID=%s", sb->s_id);
	seq_buf_putc(&sbuf, 0);

	...

	/* Add null terminator to strings array */
	*envp = NULL;

That does look a lot cleaner than opencoding it.

--D

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ