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]
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]
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]
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]>
Provide primitive malloc, free, and realloc functions for bootwrapper.
Signed-off-by: Mark A. Greer <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>