]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 15 Feb 2023 13:05:57 +0000 (15:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:10:55 +0000 (23:10 +0900)
commit08d34d5fbfd2785de176e396d75ef18677e6b472
tree5839049a99dfab066705a7cac4814f6b98fd9564
parent423388e3df29bb26446428fc944a715c5412c75a
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem

[ Upstream commit 22a8be280383812235131dda18a8212a59fadd2d ]

malloc_and_init_memory() in fill_buf isn't checking if memalign()
successfully allocated memory or not before accessing the memory.

Check the return value of memalign() and return NULL if allocating
aligned memory fails.

Fixes: a2561b12fe39 ("selftests/resctrl: Add built in benchmark")
Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/resctrl/fill_buf.c