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 DD5F619C54F for ; Thu, 11 Dec 2025 10:43: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=1765449834; cv=none; b=MTaIbDZSsDfiT97H6r/KBDzkK6a9lrThCdMeM7c5SiVTvkkX4bVuW/q4Cg5+GIqFxN6V7IXHcfEyKuUrUtljpdCgx0Tkg4VDZKIg0FB2E99T4D/Ht6jiT9OP5wt4IhRcC6AZ4ljKLG0V6i910irLyTVow4srtL4sBVfpiQ1KGM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765449834; 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=l0iRiB+05aL5ct55GoP9/R7tqV3IFZVoHGguBJucyJ1B0xnf5jBa2UM4vR0CdhkWpWofN8EZsKIfapdhH28u5g46oHNizHr75MLYcACCQ8wnSSQDF8AxfZQAiHBchJnOr7i3mVJfHV3eWNDAv8kGZGBlbmAaCxWue8fNbF4YFng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K9zhqO8e; 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="K9zhqO8e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 978E1C116B1; Thu, 11 Dec 2025 10:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765449834; bh=2xVmGhP0PFx/hs6+oME8OSKXBynf/1IS5/aMFkAz6UI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K9zhqO8ebB/VUKGBrQ1r3WX69JHHTEQgI9B2kxnC+jLmwKWooo/4A1tZV9T7+p3fT zp6P20bxrtxphcno96IgwkJNTcEJCje7itPRtpTyvccmzzGp2ARk5zTomK7iFlye8s 7C23XcNrJNfI0j9O5ZU5eo0X4tA/FKAAqWIHLvclQ8unbHXg9dBo6veu+Nso8/aVxs 698U5ANWF94kPC18hsxXLCsF8OBftDF0MNEGsR+yeBn3R0Yy7ccLtGo/Yt6vGju2R2 A+rs5KtDnTcxGNzvNgSyjwa+/AyQSXuTzYWkjjH70GbYOFR+3B8+wIYA1WgQ0Mc5iC qUBuz7R20S4zg== Date: Thu, 11 Dec 2025 11:43: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 v6 1/4] array_size.h: Add ARRAY_END() Message-ID: <5973cfb674192bc8e533485dbfb54e3062896be1.1765449750.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 19911304BC6 for ; Thu, 11 Dec 2025 10:43: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=1765449842; cv=none; b=G5sZTu2h5pqAkeFR5DRmcGCl/PrTg9x7Sy1BSi8F5OXciDQdmKrcTCKmIPjaikE+f55xGs979k/Cz+PtnXz4LHe1yEOvzxqwzDT+57XZGvc9cokRNI/eCe4Ez/rr/Glgu8WRljO+6+HhXYm3hP6g8Y7a43R6fmGxwh0xcVjriho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765449842; 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=J2JUKd9FXdBqtrswM2yDY+XLmZuR5S3bVZj1rT3WlsKF2EErxEpJR+ACVnmyzuf+bdwLEs46+lZ9ZWWM95o9dPWz7W2VDT1aAyJckIHCz3gVdPTuCMLca8qRA3K9RCi2Q3U7T2MkViCdcuCO3XwR6A6jwzGwLBTeMb6g6dAH3fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HBoVWUbI; 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="HBoVWUbI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7B94C4CEF7; Thu, 11 Dec 2025 10:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765449839; bh=Rsfmd7zbC+kSZ3iat7Z+yufKodHJKLHaalHhwgTU+L8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HBoVWUbIPjgDrlY7e+sbBXcwhv9wyvl/oGC9FVjnkNVQbmXNcvHpSiizWHBTWgmVu 676b5JCo+l/vhSxnZkG5ex76Egqqm4ujKFANztBXWD/69rPUxapQR+jv7fWXfH8rMO 7bBSCRPpnBWxr7QFRqPeSuCaQv+kuC1EXcei63Z0N4r0T8q7IsyF1cdxJAqLa79re/ 6S1wWL9Ofd/CVmAMEIKMEM+TCjSxJjn6f5/0o4BDhkIWCohnLcMd/e72uqPy92Txqp TeaIWji2IswH2f6gsDWEVp+tHgksXSMZekCWKawCfVxLWFHlpm2TNBjIjHsJkH5rVD CRfGfp2igqIcw== Date: Thu, 11 Dec 2025 11:43: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 , "Maciej W. Rozycki" Subject: [PATCH v6 2/4] mm: Fix benign off-by-one bugs Message-ID: <9c38dd009c17b0219889c7089d9bdde5aaf28a8e.1765449750.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 7430A304BA8 for ; Thu, 11 Dec 2025 10:44:05 +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=1765449845; cv=none; b=PSSj6ziU82OkVfDjfP6HiBCIAUXJ6zJUI0CxCm/uR/H/+U7Q3ZqYC9Luq60mCTBGrDXKP7+CptlBBtX2DFPrH7yJvrwjyuGgWY6WarlAp2dujrkA/pbkFeDQKG0vw8Y5jS713sxgiKnQ1Vdzdsr7EOJt45GczTM/ArV6m3vXqq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765449845; 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=Z6IGHIHTbHD0JKGBf2GMJ+0tkHhv4zJ1ExcrmJeMJTikalKagR6k1LTmPBvmSedddxmbdvSAvwgacasxcDP/SAbnuI0vvLGJ82tO9UEGr7qmBAkt2yMyvapHnYrzkbojcvEDdsZc3t4I/nIaRTvqJX9y0Ae7aOYL/olTmDFzhJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pFRMtGnp; 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="pFRMtGnp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB4F1C113D0; Thu, 11 Dec 2025 10:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765449844; bh=59w6p5OIO0ukVj/H6iWXGVoWsjSUgZ8nYZ9Xx2PeP8w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pFRMtGnp9RaLnA9mlaRXpbbMcuS+xYuOfR1yP6HZrKcoc1/kbsmlAEIHzj+qjL/Ou U53bywg7t70e7VKIw/XqRSiv+S0O2zunvOs/eXkSnpZF0g8gt4Lae1hMLpmx4ywwNm mdTyld7hpKguk9olXKkALV9XX78jXdmALbMUCNzijnYtPlOKMlF/tlVhCFoeEoB+2K +PHtP9fdooYv+bVZMN46dtP3AHSa0okswCjS58gPniD6jvbPLIsii2pj0QLg7Px5cn KG/x74sgOdKag8Q6WbRyvmpuKMYgg8OSY4ykcYEM3Y4uobRBYPvGW/qDk8wxab+d+a gzpaE4JsJytvw== Date: Thu, 11 Dec 2025 11:44:00 +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 v6 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 1BACD305048 for ; Thu, 11 Dec 2025 10:44: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=1765449850; cv=none; b=hca7Coo8p3BUpdRUe0N6LANFZmxf5OJddXajFw4CTtlD5ooY0+HMj6r/Y70ukZpLDSirdHMYhlyI9rPojRQOdJUaiJm9/8qWC1vimwIrxi+BGIUVgCanxtE8+WaKyMU6UO2jwdC5MnQ3DwhnjlMf0WC2hUEktEp+5dYhkT9/Blg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765449850; c=relaxed/simple; bh=AW/I4n2Zznh3mDRmErapu5OH/Tja5kRysX9LI6GHSSM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aO8SS1oHkkcmFnhHtPGaGEh94YJi57CdBHNwzTLB/mTHU/LxEqKXvO4PR/pMHiDENAnFIlVa9Jcro+OrIeftUIOVYWY53uEn1e9FxhqOdlwJxcIC19460snPU97riMK9rO5lkvxQ3XRkzFBmF714BBhP14V8t9HU/DDYNDdEhBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SXtVyLRF; 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="SXtVyLRF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99F56C4CEF7; Thu, 11 Dec 2025 10:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765449849; bh=AW/I4n2Zznh3mDRmErapu5OH/Tja5kRysX9LI6GHSSM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SXtVyLRFXLgpEWU+aax8xuITVDHdmrMq+nnthPMygNMw5SkAnUEj6yknaLr4eWU3f 6eFi4lDk28GP9T46f4tUYnCS7/MoJp9AOPZayUCFHJc/RDkimACUxwqXl2Kx0UEub3 wPvDrZ3rddz9+9Cc7N36icqNi117vRnZ1aew/G1A3D1ipWNu62Jc0XwLVoZDwVulog Z1C5glIzpBNfTlRotN0Nd+vnZqwUV7633bgj7S+uChyIWfpOnPjAlnEcaifU3k4s0d 4L7rpMWLyJ7ubUoXq5olYCWQA5BQkHKRiB8DLYM3OUmLDN1tlY/DyMFg6xwXntnF/A gqG3ttEBz+EaQ== Date: Thu, 11 Dec 2025 11:44: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 , "Maciej W. Rozycki" Subject: [PATCH v6 4/4] mm: Use ARRAY_END() instead of open-coding it Message-ID: <2335917d123891fec074ab1b3acfb517cf14b5a7.1765449750.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" There aren't any bugs in this code; it's purely cosmetic. By using ARRAY_END(), we prevent future issues, in case the code is modified; it has less moving parts. Also, it should be more readable (and perhaps more importantly, greppable), as there are several ways of writing an expression that gets the end of an array, which are unified by this API name. 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