* + selftests-cgroup-test_zswap-check-malloc-return-value.patch added to mm-unstable branch
@ 2026-11-10 6:08 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-11-10 6:08 UTC (permalink / raw)
To: mm-commits, yosry, nphamcs, hannes, chengming.zhou, zhangchujun,
akpm
The 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 <zhangchujun@cmss.chinamobile.com>
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.
Link: https://lore.kernel.org/20261104095315.2326-1-zhangchujun@cmss.chinamobile.com
Signed-off-by: zhangchujun <zhangchujun@cmss.chinamobile.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yosry Ahmed <yosry@kernel.org>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
---
tools/testing/selftests/cgroup/test_zswap.c | 2 ++
1 file changed, 2 insertions(+)
--- a/tools/testing/selftests/cgroup/test_zswap.c~selftests-cgroup-test_zswap-check-malloc-return-value
+++ a/tools/testing/selftests/cgroup/test_zswap.c
@@ -503,6 +503,8 @@ static int test_no_invasive_cgroup_shrin
if (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 zhangchujun@cmss.chinamobile.com are
mm-page_owner-use-%u-to-print-the-stack-depot-handle.patch
selftests-cgroup-test_zswap-check-malloc-return-value.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-10 6:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 6:08 + selftests-cgroup-test_zswap-check-malloc-return-value.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.