Michael Ellerman
f2d5bccaca
powerpc/boot: Only free if realloc() succeeds
...
simple_realloc() frees the original buffer (ptr) even if the
reallocation failed.
Fix it to behave like standard realloc() and only free the original
buffer if the reallocation succeeded.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://msgid.link/20240229115149.749264-1-mpe@ellerman.id.au
2024-03-03 22:20:29 +11:00
Li zeming
69b0194cce
powerpc/boot: Handle allocation failure in simple_realloc()
...
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@nfschina.com >
[mpe: Reword subject, use change log from Christophe]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://msgid.link/20221219021816.3012-1-zeming@nfschina.com
2024-03-03 22:20:28 +11:00
Michael Ellerman
e01432baf6
powerpc/boot: Convert more files to use SPDX tags
...
These files are all plain GPL 2.0, with a second sentence about being
licensed as-is.
Similar to the rule in commit 577b61cee5 ("treewide: Replace GPLv2
boilerplate/reference with SPDX - gpl-2.0_398.RULE").
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20220819110430.433984-1-mpe@ellerman.id.au
2022-08-26 11:02:17 +10:00
Geert Uytterhoeven
4ca478e606
[POWERPC] bootwrapper: Use `unsigned long' for malloc sizes
...
Use `unsigned long' for malloc sizes, to match common practice and types used
by most callers and callees.
Also use `unsigned long' for integers representing pointers in simple_alloc.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@eu.sony.com >
Signed-off-by: Paul Mackerras <paulus@samba.org >
2007-04-24 22:06:54 +10:00
Mark A. Greer
01a6372008
[POWERPC] Add simple memory allocator to bootwrapper
...
Provide primitive malloc, free, and realloc functions for bootwrapper.
Signed-off-by: Mark A. Greer <mgreer@mvista.com >
Signed-off-by: Paul Mackerras <paulus@samba.org >
2006-10-23 12:49:19 +10:00