selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
stable inclusion from stable-v5.10.180 commit 4075fbcde40f2e12130964abedfb418469238af1 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8DDFN Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4075fbcde40f2e12130964abedfb418469238af1 -------------------------------- [ Upstream commit 22a8be28 ] 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: a2561b12 ("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> Signed-off-by:
sanglipeng <sanglipeng1@jd.com>
Loading
Please sign in to comment