From nobody Sat Feb 7 18:35:01 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 9E31521CFF6 for ; Sun, 9 Nov 2025 18:06:59 +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=1762711620; cv=none; b=Jc5q0S6RD8aajEDSKxyfx8YERSQLal+AXA1ylhz3cRpR+VfSKDRnjekuAxhEAwdXuWjcyFptbca2zZcZh4lI0d3pcpUHHQZwULu1AsMosGhq2KbA0DRUM/166qJz9XUEOj/Tvs+3T2sUQHAh6L0Q2bb2LvC9/VLCORzVpnV+Ahc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762711620; c=relaxed/simple; bh=NCUBtJbYbJUSM0PsF/hMhn60Ld0of4iArhANi0uVhgc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Cb6yEtySAGbgV5JBvr/vVGXMo9folT27PQUk/B/n5tnjECtMXr6ZW9JvhwvnhosigeshJIf01EwCeT+XfgSswXrxRFxrYxWkYDWA5mN1oxdlaAoZuR9LaXQRUPtjFDOEA+KOh1R1kIMnG1XfVOU/EyjgiAzEVj7Z/+k0TvpiY0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aDkCAdDT; 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="aDkCAdDT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 423E4C4CEFB; Sun, 9 Nov 2025 18:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762711619; bh=NCUBtJbYbJUSM0PsF/hMhn60Ld0of4iArhANi0uVhgc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aDkCAdDTBKcWRXGOcI+UXsgw84QaqZW8IzPm/a5rL26dy7qe0gMOs2b6A+v9DgZj2 +DIGa0IqVmPRS/VbYmO4TJJYdIUvsj6jXaQrQ5yBqUR+cIN15YTt73BjpaPdLFmRgc vCkxN7ZDOIWaOzuTDOqZDjpFyoH7hQBXCTHATd8m+SIsmvc0x6wH3gc2CAC2NYPxwf SabU9UBOkBkGKWrKgWjHub/Rdr7mMOcbR4e8SQ1306D4JrbsjjG6JKhkTsnrDhrs8P HGTtJ+zmeAlXnotgcVFov1Ztmv6+6SauSlmGzOAKT2Gt4meJIs6ftUeg0as/tFPkNy SCdW6cr5zTyAQ== Date: Sun, 9 Nov 2025 19:06:54 +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 Subject: [PATCH v3 1/4] array_size.h: Add ARRAY_END() Message-ID: <2cb4ddff93b3d3037ef8d094de94227982117f87.1762711279.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 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..b5775b8f13de 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 From nobody Sat Feb 7 18:35:01 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 B70FE224B15 for ; Sun, 9 Nov 2025 18:07:04 +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=1762711626; cv=none; b=O0bKLNMJeEOW9JC60PW/PiBjW1hbwpuiovizgsMnVaNqPFNcp4/NS9aaAfgKhyAq0AnN1WDnm9LPsNUelZkD8yfwF2LRmsslVv2t4+zUPjQwj9Ev2NA1zxLRZUFSgT8+MHQ81Zl0uKoi9gKXQqcxvdzYQq57Z3KC7k7zT60B1cY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762711626; 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=t5oeC3gp0QuqSi3c3tGSXchzNC1ThhajnA/OMMRXsYlm2pm9pkYp77TpLYLKpIRhXo7w37iHU2kSBEDz31TU6Nh/IpGpR4vpVfOAK6aFM8copUmgMzvaq27Ckn0XtrQFlkDAY6gLu/d4KXgaijF+TvR3xojqgpd12CA6DCH2XmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r4l6bBR+; 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="r4l6bBR+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F22BC4CEFB; Sun, 9 Nov 2025 18:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762711624; bh=Rsfmd7zbC+kSZ3iat7Z+yufKodHJKLHaalHhwgTU+L8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r4l6bBR+x/wYLFdBSbtrGEd6woZznOFVZnH0r9s2erJWpuz7nykmFQVCQpBbw0PHi kBR6AJir9BuoO165Hel1lDGlfK/BIcg6S5gINxdT7rhP0fBX/nyAEUVlS8lJKw0Sau IJNrXe4OD7939BXLdQ8qB9qMLdPMw3QM4EQFodO2PPj4qmoTr6tG9z1u8daz/GGBIJ wLzSxhLIt3s7zxeHLaCuXB2ghbY4o5Mo9P4rs+A+HTZa5H96TnEWQLZq61NM1NAk3A jrNv2m1xnfwMfiPoZWq3tdUYE+jpmmGcmg4dP/kQZUTert0ZpVnmANvFht9GimNVB7 EwgZihfV2WUtw== Date: Sun, 9 Nov 2025 19:06:59 +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 Subject: [PATCH v3 2/4] mm: Fix benign off-by-one bugs Message-ID: <831155f02bec5ed4ef2be1d427ea18c46446c127.1762711279.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 Sat Feb 7 18:35:01 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 B0CFB2264C0 for ; Sun, 9 Nov 2025 18:07:09 +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=1762711629; cv=none; b=IRwNHAfDBrYsmWwmq2YDhmaCAH0/96bxMEqBfLy+kFXLOBI3zMHxxFDr/4ExgRSjPbOjJFGlr53QYe4Qg6Pt+a55PW9uoXH98T+eYLfrJvcwYsffGoWDibLiSJlgumeoCFpbdQsDusUcoClrMTlma/IQ53qvFaMOhOrj8bk62Tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762711629; 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=JWOkQHKj5zPd/fF6Kcwtxqy7p7ThsYAQk59Pxj+eR1at9ywC+Q4zWNikGCEvw9JDjUjYePc96H2F57Z2i/VLzuagxuVWcexP5x7Y1GuAQqYqQUiPpH+jk1NDbUHYnNfvU73aJhGXIs7xyhouwQ5BBjsyYNFC37oUYV1nIcrUptc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m75WjUhq; 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="m75WjUhq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4887CC4CEF8; Sun, 9 Nov 2025 18:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762711629; bh=59w6p5OIO0ukVj/H6iWXGVoWsjSUgZ8nYZ9Xx2PeP8w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m75WjUhql6v/TjVEVnpOWQ1J/FB300lERpRYAirZ1FL9l76CpCRBfww1t2a35snQD tJHog/nimE0l2EWB/xf3G7qrVi9oDltBkClxF+5wivdARDiJS82n+dVL+gBKvKd8BR v/8JUuiy6YMgm4mnDcTl44gppUgZ/Wyo5IFO+cH2sa9UGBl+NBzQtaPOFGfayVhBD+ 867kDhk1O0Gc6+aNChoD4zHmiq4wxs2CHEGKY/HJnXV/ww0wv+WJhTpq7pcJlFswDD AecDB2oiiUD1yMcLmdGjs44qVENg+pvI5a2EtLzvTW+1c+3RwlEOqTma9hq9YQhjBj MpMRGrTMqp8EQ== Date: Sun, 9 Nov 2025 19:07:04 +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 Subject: [PATCH v3 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 Sat Feb 7 18:35:01 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 C0ECA21CFF6 for ; Sun, 9 Nov 2025 18:07:14 +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=1762711634; cv=none; b=h2GtxVarXHVsJ8NAk1H4b+eqlgqIreCIoorjN+UQoR3ZIJchv72qYZH3GNkpFayGH0E8ofgPqEEWScfScEP0XtVn/rzWLoE6iJ9nOa1sQRSYdrXeVmGcy3Xomov7CQ6D5dxudA3ZWwxnrNyv+g5J4fygtE9HVyyWslHQI9h6oyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762711634; 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=PEHUZUu8Pfs+DIBJcNciLFgkdjgcx2tfDLtzTwPgsG9tMUNn5dHZY/vYCbo82MWRRq1oxIrzfP6mR1OzkEGfcoRnSEbKiZLpeJsK5TuPNZRws3vSvPhv//374f48sEqner4Bbyo3bE7uJEKdFiDegiKrIyHdAIPfYuM/bylsgOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lfFWJIcM; 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="lfFWJIcM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B83C4CEF8; Sun, 9 Nov 2025 18:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762711634; bh=kaO5/IVrebOzmYLwKVSEsBGlfzzeuU+iOQME8bN/Vgw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lfFWJIcMlKISISBM1E6H9raA2HPW4eVb8izpDAHamiPCRjD9yz+rZZO+Q2fJ3fIXx l1CrIWkSYtNrr/srw+vokFdC8aiM6GL5aGBKc6F8r4V5qMYs0AxX9bTPuHWRPhh6n2 y0NWPsbo9B6lxCCQd8dhvtmkirgpH0ZDyIFEMIxcynaGsxqLqL5fsUYr6cfgTCtjvw Zx3Q+0RBAImo8DEEGO2wRWn+jYk8COlkpo7xghPZVTF2XugmThkdlwkZZM2bYJrJDa VtbMFW7txrWkaU9GSXR6/PG4XJG+RJx3GkyPJ7c9xO8tp1noYhZAKeu4H1Q3GQ2+W+ 13LM5qdxHEEhw== Date: Sun, 9 Nov 2025 19:07:09 +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 Subject: [PATCH v3 4/4] mm: Use ARRAY_END() instead of open-coding it Message-ID: <9646a1d194a5d2f310d4272f9c240453e68c2147.1762711279.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" 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