Patch "powerpc/boot: Handle allocation failure in simple_realloc()" has been added to the 6.6-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

    powerpc/boot: Handle allocation failure in simple_realloc()

to the 6.6-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:
     powerpc-boot-handle-allocation-failure-in-simple_rea.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 2bfba6413e948f874f8a531d583577a2c5d354b8
Author: Li zeming <zeming@xxxxxxxxxxxx>
Date:   Mon Dec 19 10:18:16 2022 +0800

    powerpc/boot: Handle allocation failure in simple_realloc()
    
    [ Upstream commit 69b0194ccec033c208b071e019032c1919c2822d ]
    
    simple_malloc() will return NULL when there is not enough memory left.
    Check pointer 'new' before using it to copy the old data.
    
    Signed-off-by: Li zeming <zeming@xxxxxxxxxxxx>
    [mpe: Reword subject, use change log from Christophe]
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://msgid.link/20221219021816.3012-1-zeming@xxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
index 267d6524caac4..db9aaa5face3f 100644
--- a/arch/powerpc/boot/simple_alloc.c
+++ b/arch/powerpc/boot/simple_alloc.c
@@ -112,7 +112,9 @@ static void *simple_realloc(void *ptr, unsigned long size)
 		return ptr;
 
 	new = simple_malloc(size);
-	memcpy(new, ptr, p->size);
+	if (new)
+		memcpy(new, ptr, p->size);
+
 	simple_free(ptr);
 	return new;
 }




[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