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: <Yoa0rBRY/wwplw0h@casper.infradead.org>
Date:   Thu, 19 May 2022 22:20:44 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Kent Overstreet <kent.overstreet@...il.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...r.kernel.org,
        pmladek@...e.com, rostedt@...dmis.org, senozhatsky@...omium.org,
        andriy.shevchenko@...ux.intel.com
Subject: Re: [PATCH v2 03/28] vsprintf: %pf(%p)

On Thu, May 19, 2022 at 01:23:56PM -0400, Kent Overstreet wrote:
> +			while (1) {
> +				if (WARN_ON_ONCE(nr_args == ARRAY_SIZE(fn_args)))
> +					goto out;
> +				if (*fmt++ != '%')
> +					goto out;
> +				if (*fmt++ != 'p')
> +					goto out;
> +				fn_args[nr_args++] = va_arg(args, void *);
> +				if (*fmt == ')')
> +					break;
> +				if (*fmt++ != ',')
> +					goto out;
> +			}
> +
> +			call_pr_fn(out, fn, fn_args, nr_args);
> +			fmt++; /* past trailing ) */

It's not a big thing, but why not make the loop do:

				c = *fmt++;
				if (c == ')')
					break;
				if (c != ',')
					goto out;

and then you can drop the fmt++ line outside the loop.

(it's obviosuly awkward; it needed a comment)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ