* [merged mm-stable] selftests-cgroup-add-malloc-failures-checks-in-test_memcontrol.patch removed from -mm tree
@ 2023-03-28 23:21 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2023-03-28 23:21 UTC (permalink / raw)
To: mm-commits, tj, songmuchun, shuah, shakeelb, roman.gushchin,
mhocko, lizefan.x, hannes, ivan.orlov0322, akpm
The quilt patch titled
Subject: selftests: cgroup: add 'malloc' failures checks in test_memcontrol
has been removed from the -mm tree. Its filename was
selftests-cgroup-add-malloc-failures-checks-in-test_memcontrol.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Ivan Orlov <ivan.orlov0322@gmail.com>
Subject: selftests: cgroup: add 'malloc' failures checks in test_memcontrol
Date: Sun, 26 Feb 2023 16:16:33 +0300
There are several 'malloc' calls in test_memcontrol, which can be
unsuccessful. This patch will add 'malloc' failures checking to give more
details about test's fail reasons and avoid possible undefined behavior
during the future null dereference (like the one in
alloc_anon_50M_check_swap function).
Link: https://lkml.kernel.org/r/20230226131634.34366-1-ivan.orlov0322@gmail.com
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Zefan Li <lizefan.x@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/cgroup/test_memcontrol.c | 15 +++++++++++++
1 file changed, 15 insertions(+)
--- a/tools/testing/selftests/cgroup/test_memcontrol.c~selftests-cgroup-add-malloc-failures-checks-in-test_memcontrol
+++ a/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -98,6 +98,11 @@ static int alloc_anon_50M_check(const ch
int ret = -1;
buf = malloc(size);
+ if (buf == NULL) {
+ fprintf(stderr, "malloc() failed\n");
+ return -1;
+ }
+
for (ptr = buf; ptr < buf + size; ptr += PAGE_SIZE)
*ptr = 0;
@@ -211,6 +216,11 @@ static int alloc_anon_noexit(const char
char *buf, *ptr;
buf = malloc(size);
+ if (buf == NULL) {
+ fprintf(stderr, "malloc() failed\n");
+ return -1;
+ }
+
for (ptr = buf; ptr < buf + size; ptr += PAGE_SIZE)
*ptr = 0;
@@ -778,6 +788,11 @@ static int alloc_anon_50M_check_swap(con
int ret = -1;
buf = malloc(size);
+ if (buf == NULL) {
+ fprintf(stderr, "malloc() failed\n");
+ return -1;
+ }
+
for (ptr = buf; ptr < buf + size; ptr += PAGE_SIZE)
*ptr = 0;
_
Patches currently in -mm which might be from ivan.orlov0322@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-28 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-28 23:21 [merged mm-stable] selftests-cgroup-add-malloc-failures-checks-in-test_memcontrol.patch removed from -mm tree 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.