Patch "selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-resctrl-return-null-if-malloc_and_init_mem.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d4ae766c60fc589495e8f18be3bbb48b8f23bf41
Author: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
Date:   Wed Feb 15 15:05:57 2023 +0200

    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@xxxxxxxxx>
    Signed-off-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
    Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c
index 56ccbeae0638d..c20d0a7ecbe63 100644
--- a/tools/testing/selftests/resctrl/fill_buf.c
+++ b/tools/testing/selftests/resctrl/fill_buf.c
@@ -68,6 +68,8 @@ static void *malloc_and_init_memory(size_t s)
 	size_t s64;
 
 	void *p = memalign(PAGE_SIZE, s);
+	if (!p)
+		return NULL;
 
 	p64 = (uint64_t *)p;
 	s64 = s / sizeof(uint64_t);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux