+ selftests-cgroup-test_zswap-check-malloc-return-value.patch added to mm-unstable branch
Andrew Morton
tree noticeThe patch titled
Subject: selftests/cgroup: test_zswap: check malloc() return value
has been added to the -mm mm-unstable branch. Its filename is
selftests-cgroup-test_zswap-check-malloc-return-value.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-cgroup-test_zswap-check-malloc-return-value.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: zhangchujun <[email protected]>
Subject: selftests/cgroup: test_zswap: check malloc() return value
Date: Wed, 04 Nov 2026 17:53:15 +0800
test_no_invasive_cgroup_shrink() uses zw_allocation immediately after malloc() without checking for allocation failure.
Check for NULL before accessing the buffer and use the existing cleanup path to report test failure, matching the handling of wb_allocation later in the function.
---
tools/testing/selftests/cgroup/test_zswap.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/cgroup/test_zswap.c renamed from tools/testing/selftests/cgroup/test_zswap.c~selftests-cgroup-test_zswap-check-malloc-return-value +2 -0
@@ -503,6 +503,8 @@ static int test_no_invasive_cgroup_shrinif (cg_enter_current (zw_group)) goto out; zw_allocation =malloc (allocation_size); +if (!zw_allocation) + goto out;for (int i =0 ; i < nr_pages; i++) { off = (unsigned long )i * page_size;memset (&zw_allocation[off],0 , page_size);
_
Patches currently in -mm which might be from [email protected] are
mm-page_owner-use-%u-to-print-the-stack-depot-handle.patch selftests-cgroup-test_zswap-check-malloc-return-value.patch