Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/smp: Add check for kcalloc() failure in parse_thread_groups()

As kcalloc() may fail, check its return value to avoid a NULL pointer
dereference when passing it to of_property_read_u32_array().

Fixes: 790a1662d3a26 ("powerpc/smp: Parse ibm,thread-groups with multiple properties")
Cc: stable@vger.kernel.org
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250923133235.1862108-1-lgs201920130244@gmail.com

authored by

Guangshuo Li and committed by
Madhavan Srinivasan
33c1c6d8 4acc549e

+2
+2
arch/powerpc/kernel/smp.c
··· 822 822 823 823 count = of_property_count_u32_elems(dn, "ibm,thread-groups"); 824 824 thread_group_array = kcalloc(count, sizeof(u32), GFP_KERNEL); 825 + if (!thread_group_array) 826 + return -ENOMEM; 825 827 ret = of_property_read_u32_array(dn, "ibm,thread-groups", 826 828 thread_group_array, count); 827 829 if (ret)