selftests: cgroup: Add 'malloc' failures checks in test_memcontrol
authorIvan Orlov <ivan.orlov0322@gmail.com>
Sun, 26 Feb 2023 13:16:33 +0000 (16:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:33 +0000 (17:32 +0100)
commit801593f70be80781134e4d27988b62a399c41c5e
tree4478c3016daa54d048a0d28828da0fdf1bd22809
parent522c441faf82ab88636d66be8e25b8b7dfa2e001
selftests: cgroup: Add 'malloc' failures checks in test_memcontrol

[ Upstream commit c83f320e55a49abd90629f42a72897afd579e0de ]

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).

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>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/cgroup/test_memcontrol.c