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: <kutf23ggormqot722rp5prqjaqiyrnvj6s3xcjsqsr3lomdvs7@cgdhfowymkkv>
Date: Thu, 25 Sep 2025 15:24:37 +0200
From: Alejandro Colomar <alx@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Marco Elver <elver@...gle.com>, Kees Cook <kees@...nel.org>, 
	Christopher Bazley <chris.bazley.wg14@...il.com>, Alexander Potapenko <glider@...gle.com>, 
	Dmitry Vyukov <dvyukov@...gle.com>, Jann Horn <jannh@...gle.com>, 
	Andrew Morton <akpm@...ux-foundation.org>, Linus Torvalds <torvalds@...ux-foundation.org>, 
	Rasmus Villemoes <linux@...musvillemoes.dk>, Michal Hocko <mhocko@...e.com>, 
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v1 1/3] array_size.h: Add ENDOF()

On Thu, Sep 25, 2025 at 03:20:37PM +0200, Alejandro Colomar wrote:
> This macro is useful to calculate the second argument to
> sprintf_trunc_end(), avoiding off-by-one bugs.

D'oh!  This commit message needs updating.  Please amend with:

	This macro is useful to calculate the end of an array (that is,
	a pointer to one after its last element), avoiding off-by-one
	bugs.

Cheers,
Alex

> 
> Cc: Kees Cook <kees@...nel.org>
> Cc: Christopher Bazley <chris.bazley.wg14@...il.com>
> Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
> Cc: Marco Elver <elver@...gle.com>
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Signed-off-by: Alejandro Colomar <alx@...nel.org>
> Message-ID: <37b1088dbd01a21d2f9d460aa510726119b3bcb0.1752193588.git.alx@...nel.org>
> ---
>  include/linux/array_size.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/array_size.h b/include/linux/array_size.h
> index 06d7d83196ca..781bdb70d939 100644
> --- a/include/linux/array_size.h
> +++ b/include/linux/array_size.h
> @@ -10,4 +10,10 @@
>   */
>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>  
> +/**
> + * ENDOF - get a pointer to one past the last element in array @a
> + * @a: array
> + */
> +#define ENDOF(a)  (a + ARRAY_SIZE(a))
> +
>  #endif  /* _LINUX_ARRAY_SIZE_H */
> -- 
> 2.51.0
> 

-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ