From nobody Tue Dec 16 16:35:23 2025 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 42085285418 for ; Wed, 10 Dec 2025 22:46:37 +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=1765406798; cv=none; b=Qj+Bgd2WC+L2wGQABz+b8w20jCi2pS0mToqlS1PC8g6Kpx2U+5vTINA7A4u3b+FRldkvKjOxixuvQ1gRT6CF2gTM6EIjbi9lc63bLFDlQ81De+2mJgY2LELF5ztr2fo/lGtt/HHZRu41P0W/G2lN8VZusWo9TbH9T3pdAa8Yuns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765406798; c=relaxed/simple; bh=2xVmGhP0PFx/hs6+oME8OSKXBynf/1IS5/aMFkAz6UI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QnCWHxoCb73Mfev0rqH3jNTMaFy4+jmvBCg0kttzFhMvBTFpJDdH9mWusDMZ/gkkavUrkOIk68KUUkcsRYY9lymG4yUr07Witrn2aOEP1vzAkKwNbdW7HPa0zX3EcklxNJXeE5rdnycydcfJrmeaLDgWfWMKLnbKdrtWTxO4dZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p0j+r5f9; 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="p0j+r5f9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF61DC4CEF7; Wed, 10 Dec 2025 22:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765406797; bh=2xVmGhP0PFx/hs6+oME8OSKXBynf/1IS5/aMFkAz6UI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p0j+r5f9ceLd8JHdJaXG7/kP8pHtSxWUPFhU+TbgylfEi6XsCOmOT7ltMtjUZtofz Qs1F+acTHhoCLqplDmCTxk9we3iblfj2QoOLV78cMgJf2XnhfPwfuXrjyBm0TgaIuP D5OMULpUvRNtf24eC2PYQhofqtglZFrh2rA5QOqN0vK/E6WtbZ22LfeQD4pTYsuqye s3IZnsmwfqd1GpC8sFO37M4ynILFwQuQST9kbk47DJm6ArDM/BTk3WhCTA99mwg4iR ehvsbtK5Kwr39gN2HxoYTOuanvMnE16zsb0qeY/eVBI6ELoiJucKZE4NdeX2Fxt7ca nPMzwhrijLiww== Date: Wed, 10 Dec 2025 23:46:32 +0100 From: Alejandro Colomar To: linux-kernel@vger.kernel.org, linux-mm@kvack.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 , "Maciej W. Rozycki" Subject: [PATCH v5 1/4] array_size.h: Add ARRAY_END() Message-ID: <5973cfb674192bc8e533485dbfb54e3062896be1.1765406337.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 < ARRAY_END(a); p++) ... Cc: Kees Cook Cc: Christopher Bazley Cc: Rasmus Villemoes Cc: Marco Elver Cc: Michal Hocko Cc: Linus Torvalds Cc: Al Viro Cc: "Maciej W. Rozycki" Signed-off-by: Alejandro Colomar Message-ID: <37b1088dbd01a21d2f9d460aa510726119b3bcb0.1752193588.git.alx@ke= rnel.org> --- drivers/block/floppy.c | 2 -- include/linux/array_size.h | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 5336c3c5ca36..69661840397e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4802,8 +4802,6 @@ static void floppy_release_allocated_regions(int fdc,= const struct io_region *p) } } =20 -#define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)])) - static int floppy_request_regions(int fdc) { const struct io_region *p; diff --git a/include/linux/array_size.h b/include/linux/array_size.h index 06d7d83196ca..0c4fec98822e 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 @arr + * @arr: array + */ +#define ARRAY_END(arr) (&(arr)[ARRAY_SIZE(arr)]) + #endif /* _LINUX_ARRAY_SIZE_H */ --=20 2.51.0 From nobody Tue Dec 16 16:35:23 2025 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 759902C11CE for ; Wed, 10 Dec 2025 22:46:43 +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=1765406803; cv=none; b=IxQ0o+kar6mmVpOxcvFkuWyEwYet9WDgOo1EofAykOhcXDFjBcNlRtRw28kjCKYUcZeTVR7mXSsg4134Kv3RsffKM5eJewLgtVuMPaymrNpappGuvGU/O9+AHXdWq5eBdyuo0fid5uWJXhR2pvk4egNhDo55NrVGJAWdM7/cfgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765406803; c=relaxed/simple; bh=Rsfmd7zbC+kSZ3iat7Z+yufKodHJKLHaalHhwgTU+L8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IeOw/W6hqMsqr3s9O32HvFFfhUTAWtxQR+27p61U6g0GfzpvRUBofhxJsv6eiBsl88mwXVvJ0CBwahSNUzb9Oq8gnzpLwxml0eBIdfIOiZtK2fpstZp/EBvqRzctP6Ci29Vgs58gJt+K+saepBScJ2H6EQ/sZlaq2dRvoEAPogo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GgfixRCi; 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="GgfixRCi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 617C3C4CEF7; Wed, 10 Dec 2025 22:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765406803; bh=Rsfmd7zbC+kSZ3iat7Z+yufKodHJKLHaalHhwgTU+L8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GgfixRCi7D7zmf3LonNP4Ozluj3wnGSed4vLDV4g17ge/6u5M1FsXvVGvX9p4ZrpS M+IsDN9v6aU9atxImKnxkehgn/1UxkHVP0Mn0N9ScQY/Qv0ZJnH2hOmqw9hL/KZ8lI kOheLRRqM/O3o7/HcKvk8lLIhulQdS3hWsRx9Y7iJ9gwrdwXI8VFVf0fXYo4lvIpyR nCc4DBMJDwv6nwS7OZhwHtWVz81y/SAHIp9VrpBNaXQoG6UehgOSeq6bPOHLxmXgJ4 RWiF73VfH7N+ezRbnYv5wey494xpQZoY09iLJkLrZCoBznINB1eJgpdCwVroGuGduU d7cpqDth50dig== Date: Wed, 10 Dec 2025 23:46:38 +0100 From: Alejandro Colomar To: linux-kernel@vger.kernel.org, linux-mm@kvack.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 , "Maciej W. Rozycki" Subject: [PATCH v5 2/4] mm: Fix benign off-by-one bugs Message-ID: <9c38dd009c17b0219889c7089d9bdde5aaf28a8e.1765406337.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" We were wasting a byte due to an off-by-one bug. s[c]nprintf() doesn't write more than $2 bytes including the null byte, so trying to pass 'size-1' there is wasting one byte. Acked-by: Marco Elver Cc: Kees Cook Cc: Christopher Bazley Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Jann Horn Cc: Andrew Morton Cc: Linus Torvalds Cc: Rasmus Villemoes Cc: Marco Elver Cc: Michal Hocko Cc: Al Viro Signed-off-by: Alejandro Colomar Message-ID: <515445ae064d4b8599899bf0d8b480dadd2ff843.1752182685.git.alx@ke= rnel.org> --- mm/kfence/kfence_test.c | 4 ++-- mm/kmsan/kmsan_test.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index 00034e37bc9f..5725a367246d 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -110,7 +110,7 @@ static bool report_matches(const struct expect_report *= r) =20 /* Title */ cur =3D expect[0]; - end =3D &expect[0][sizeof(expect[0]) - 1]; + end =3D ARRAY_END(expect[0]); switch (r->type) { case KFENCE_ERROR_OOB: cur +=3D scnprintf(cur, end - cur, "BUG: KFENCE: out-of-bounds %s", @@ -140,7 +140,7 @@ static bool report_matches(const struct expect_report *= r) =20 /* Access information */ cur =3D expect[1]; - end =3D &expect[1][sizeof(expect[1]) - 1]; + end =3D ARRAY_END(expect[1]); =20 switch (r->type) { case KFENCE_ERROR_OOB: diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c index 902ec48b1e3e..b5ad5dfb2c00 100644 --- a/mm/kmsan/kmsan_test.c +++ b/mm/kmsan/kmsan_test.c @@ -105,7 +105,7 @@ static bool report_matches(const struct expect_report *= r) =20 /* Title */ cur =3D expected_header; - end =3D &expected_header[sizeof(expected_header) - 1]; + end =3D ARRAY_END(expected_header); =20 cur +=3D scnprintf(cur, end - cur, "BUG: KMSAN: %s", r->error_type); =20 --=20 2.51.0 From nobody Tue Dec 16 16:35:23 2025 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 7CBCA26056D for ; Wed, 10 Dec 2025 22:46:49 +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=1765406809; cv=none; b=nSYz1rD9B/AGYrI0W7/2t1fTqO3fzwEsgR+BQFsGUNiPOOQtNbCeZI0m+tFIr13Z4b6JQQFqE+ZejFdYQB27o3rspfs7Se9dtdatPVGDHSgunnj1864sp+lezDqmOTYbiJVSehxkz0Aq3BAxPIOZfRFaxjYcF/nA1ym2ZBe+Pzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765406809; c=relaxed/simple; bh=59w6p5OIO0ukVj/H6iWXGVoWsjSUgZ8nYZ9Xx2PeP8w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fc03TNmhlbF3T1SoTDOSWwoMMQsn7HlRcQgn4g5vclF9JRsG/zdz6m4DK04kgTryqm77n5VtLnIrofd2DDApMnj91Mpf0jUhm1rUv0Pu/VDKsArHymz7IhXHiV4D2dGxsRcsxvej+/m2tE3NDSqTtdBg6O2DEg4tpyhUkuXmIUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uFWUzHtI; 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="uFWUzHtI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8716C4CEF1; Wed, 10 Dec 2025 22:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765406808; bh=59w6p5OIO0ukVj/H6iWXGVoWsjSUgZ8nYZ9Xx2PeP8w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uFWUzHtIKq0MdPLcgSoXxbDdivKFxFKV1hp7nbScDSw1btmYrugRIksf/Ptp01M6P MH/3J8wMmqP/NL0xrOyoLEBzAV5DQ+QdLkUn0SgOnVnNi3aQGTOQ/EQYFE2ZfVY8H1 ovFvbVl0+hw+plYIJRA4vCwoRvqijDh/qoAduzz2EuOgrrpmdesVezoJqdTpp1seyY A9avXq9Rh6ynPSwej7BJ6us7vJZ7qwBKNlTLq/Ni8QWAJ6YPTO7fHRDdngC+frYVyg uUCHwHPv+9I5WsIRW5WKvWB5Pgbsi9FqrOpZScgd/Vq+4SSF7iFhzE6nvTqCjhd/bb jnVTodwRHhf0w== Date: Wed, 10 Dec 2025 23:46:44 +0100 From: Alejandro Colomar To: linux-kernel@vger.kernel.org, linux-mm@kvack.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 , "Maciej W. Rozycki" Subject: [PATCH v5 3/4] kernel: Fix off-by-one benign bugs Message-ID: 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" We were wasting a byte due to an off-by-one bug. s[c]nprintf() doesn't write more than $2 bytes including the null byte, so trying to pass 'size-1' there is wasting one byte. This is essentially the same as the previous commit, in a different file. Cc: Marco Elver Cc: Kees Cook Cc: Christopher Bazley Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Jann Horn Cc: Andrew Morton Cc: Linus Torvalds Cc: Rasmus Villemoes Cc: Marco Elver Cc: Michal Hocko Cc: Al Viro Signed-off-by: Alejandro Colomar --- kernel/kcsan/kcsan_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c index 219d22857c98..8ef8167be745 100644 --- a/kernel/kcsan/kcsan_test.c +++ b/kernel/kcsan/kcsan_test.c @@ -176,7 +176,7 @@ static bool __report_matches(const struct expect_report= *r) =20 /* Title */ cur =3D expect[0]; - end =3D &expect[0][sizeof(expect[0]) - 1]; + end =3D ARRAY_END(expect[0]); cur +=3D scnprintf(cur, end - cur, "BUG: KCSAN: %s in ", is_assert ? "assert: race" : "data-race"); if (r->access[1].fn) { @@ -200,7 +200,7 @@ static bool __report_matches(const struct expect_report= *r) =20 /* Access 1 */ cur =3D expect[1]; - end =3D &expect[1][sizeof(expect[1]) - 1]; + end =3D ARRAY_END(expect[1]); if (!r->access[1].fn) cur +=3D scnprintf(cur, end - cur, "race at unknown origin, with "); =20 --=20 2.51.0 From nobody Tue Dec 16 16:35:23 2025 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 A153726C3B0 for ; Wed, 10 Dec 2025 22:46:54 +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=1765406814; cv=none; b=iGe2yNp7HbgNdNKZ2HV5i/d9rnF+Y3d+pl22dYcAzgE0bhWZnNHlQCLRHPbPAocDHCelWj0KhPlq575wWHlNo6Ds2sQU5PqkJEKTcsVwr6wDH6ILHmJBjfPOJI5tSwhLUwKXqhSQtqLFssYaAbInDU7aqqqf6n48klU7XVmVKxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765406814; c=relaxed/simple; bh=kaO5/IVrebOzmYLwKVSEsBGlfzzeuU+iOQME8bN/Vgw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=thXi5h40Fcprq23xWKasY9rWKo0RTgNiVmIfgUIn6X4ECjxDM3jf4/A6BJoP0buAQoiGXnQvwMjTuzoIBIsk7aPbnEywCFlvjud1RQfUpDqFCFf4OIjk//Jvguo79Ivece+krJUvRlzU4+vMtf2zOCUQ3gspiB30CfHv6wAyVT8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vGoU5FeA; 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="vGoU5FeA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 512BAC4CEF1; Wed, 10 Dec 2025 22:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765406814; bh=kaO5/IVrebOzmYLwKVSEsBGlfzzeuU+iOQME8bN/Vgw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vGoU5FeA59wGMSVS/oe23fWJODFVAbgzS4TcYIXkiWJIUE+7GrBl7g2Qpeg9uOn0d ZK00h9Z0EtzY+hPQRSo5DJkabZRWE9HFCHSOYexrt5maRs8wzmewyQSPGTkU7xNh3a gt/dlmG6YjYgf8l8gF/eLOqgvc2tqR8KGQxTJLlCkLoz9GexcBaQ8kw/0Dmuf01Xqo auN2YfkoPj3OnFSvjHJ8SohgdmxRYL/MG0QgNP4H2d4MGxh0zFh2b9FnEmzYuk6t3a ZiVkdDbK9d1tEo8vTv1q9B88mkl+36z7MpDjhClKZguV0Ucy1bxBSStUTCRmNKe8HP JFNC7pLZiMo5g== Date: Wed, 10 Dec 2025 23:46:49 +0100 From: Alejandro Colomar To: linux-kernel@vger.kernel.org, linux-mm@kvack.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 , "Maciej W. Rozycki" Subject: [PATCH v5 4/4] mm: Use ARRAY_END() instead of open-coding it Message-ID: 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" Cc: Kees Cook Cc: Linus Torvalds Signed-off-by: Alejandro Colomar --- mm/kmemleak.c | 2 +- mm/memcontrol-v1.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 1ac56ceb29b6..fe33f2edfe07 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -510,7 +510,7 @@ static void mem_pool_free(struct kmemleak_object *objec= t) { unsigned long flags; =20 - if (object < mem_pool || object >=3D mem_pool + ARRAY_SIZE(mem_pool)) { + if (object < mem_pool || object >=3D ARRAY_END(mem_pool)) { kmem_cache_free(object_cache, object); return; } diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 6eed14bff742..b2f37bd939fa 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -1794,7 +1794,7 @@ static int memcg_numa_stat_show(struct seq_file *m, v= oid *v) =20 mem_cgroup_flush_stats(memcg); =20 - for (stat =3D stats; stat < stats + ARRAY_SIZE(stats); stat++) { + for (stat =3D stats; stat < ARRAY_END(stats); stat++) { seq_printf(m, "%s=3D%lu", stat->name, mem_cgroup_nr_lru_pages(memcg, stat->lru_mask, false)); @@ -1805,7 +1805,7 @@ static int memcg_numa_stat_show(struct seq_file *m, v= oid *v) seq_putc(m, '\n'); } =20 - for (stat =3D stats; stat < stats + ARRAY_SIZE(stats); stat++) { + for (stat =3D stats; stat < ARRAY_END(stats); stat++) { =20 seq_printf(m, "hierarchical_%s=3D%lu", stat->name, mem_cgroup_nr_lru_pages(memcg, stat->lru_mask, --=20 2.51.0