Commit Graph
5 Commits
Author SHA1 Message Date
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 <[email protected]>
Link: https://msgid.link/[email protected]
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 <[email protected]>
[mpe: Reword subject, use change log from Christophe]
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
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 <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
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 <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
2006-10-23 12:49:19 +10:00