From nobody Sat Feb 7 23:45:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7165915667D for ; Sat, 8 Nov 2025 22:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762640430; cv=none; b=GtSpHyMDj2uaG4l42sGZJoaEqTIoUNxJSbWkgPT3vB9pnzNyV3QzUfmwvc82xPvjlz/28dkAzLHFXDGiUTq3bPevcE1W6If6hLv0f6Bx7qzeiZud96uwfZQ+7dWT8mXiYek0RICKB10eoCD+xqffISm5r5cM0F0KENChQboA0p0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762640430; c=relaxed/simple; bh=D2bxUCipdqgy7ofKUDd0lFuuVmbC9ePnY5k6K23h/+w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dnLoWx7qY6eAaHRstoIKz5lerdjujfYbD+aAtN/cYooaoK3HbOogOlAlTKKBYU1FjYqdMXAwf46EGEMPKyMqh+is601zjy5Fw3uOCaSK4EiASaM4GQ4UhG8zqBEsYSH4r4oq5e9gJ27V8pAI21QMzVRB7yJHvWSt1oT144e81lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bjC/sQ5N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bjC/sQ5N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FEA9C16AAE; Sat, 8 Nov 2025 22:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762640428; bh=D2bxUCipdqgy7ofKUDd0lFuuVmbC9ePnY5k6K23h/+w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bjC/sQ5NuPgCSuQWV9UNlNlM7oSf8INiIMXyM5IyWARrTDxQhQparEQEzmO008a+9 +ksw2FOBK9HDXnno1WGQYC8tlQPmW2pcs8t3ZlHihy7s7D8hE9wnkAWpa0CP3TFuC0 o6kQuLG2BKyCbbzkblrvbNEExVT4jKm5V4PrrA5umEhAiRwY87Xixt+TEwbKzN64QO xaD9nKTAmf+mqWpw6y0j38FMacqQMZSvMkQSjJF+V5zvJosAhTZ2dl/wfgOkSKBbUb bso9E9v+s0CYMaMh+8FWOz0rrpllhIitDv8Sf0gJ1WVbQwxXDUtK7xX7Y+q/F7k6Gf GPHy5UZg4tQDw== Date: Sat, 8 Nov 2025 23:20:24 +0100 From: Alejandro Colomar To: linux-kernel@vger.kernel.org Cc: Alejandro Colomar , Kees Cook , Christopher Bazley , Rasmus Villemoes , Marco Elver , Michal Hocko , Linus Torvalds , Al Viro , Alexander Potapenko , Dmitry Vyukov , Jann Horn , Andrew Morton Subject: [PATCH v2 1/4] array_size.h: Add ARRAY_END() Message-ID: <35255c1ceb54518779a45351dcd79a3c1910818a.1762637046.git.alx@kernel.org> X-Mailer: git-send-email 2.51.0 References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ARRAY_END() returns a pointer one past the end of the last element in the array argument. This pointer is useful for iterating over the elements of an array: for (T *p =3D a, p < ENDOF(a); p++) ... Cc: Kees Cook Cc: Christopher Bazley Cc: Rasmus Villemoes Cc: Marco Elver Cc: Michal Hocko Cc: Linus Torvalds Cc: Al Viro Signed-off-by: Alejandro Colomar Message-ID: <37b1088dbd01a21d2f9d460aa510726119b3bcb0.1752193588.git.alx@ke= rnel.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..62382973078e 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)) =20 +/** + * ARRAY_END - get a pointer to one past the last element in array @a + * @a: array + */ +#define ARRAY_END(a) (a + ARRAY_SIZE(a)) + #endif /* _LINUX_ARRAY_SIZE_H */ --=20 2.51.0