coreboot-kgpe-d16/payloads/libpayload/libc
Julius Werner d61350c403 libpayload: malloc: Change memcpy() to memmove() in realloc
Our realloc() works (somewhat suboptimally) by free()ing the existing
allocation and then reallocating it wherever it fits. If there was free
space before the old location, this means the new allocation may be
before the old one, and if the free space block is smaller than the old
allocation it may overlap. Thus, we should be moving memmove() instead
of memcpy() to move the block over.

This is not a problem in practice since all our existing memcpy()s are
simple iterate and copy front to back implementations which are safe for
overlaps when the destination is in front of the source. but it's still
the more correct thing to do (in case we ever change our memcpy()s to do
something more advanced or whatever).

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I35f77a94b7a72c01364ee7eecb5c3ff5ecde57f6
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40028
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2020-04-03 19:56:27 +00:00
..
Makefile.inc Remove MIPS architecture 2019-11-20 10:10:48 +00:00
args.c payloads: Fix typos 2020-02-17 16:01:50 +00:00
console.c
coreboot.c lib/coreboot_table: Add CBMEM_ID_VBOOT_WORKBUF pointer to coreboot table 2019-12-02 13:00:45 +00:00
ctype.c
die.c
exec.c
fmap.c
getopt_long.c
hexdump.c
ipchecksum.c
lib.c Add buffer_to/from_fifo32(_prefix) helpers 2019-08-22 10:36:22 +00:00
libgcc.c
malloc.c libpayload: malloc: Change memcpy() to memmove() in realloc 2020-04-03 19:56:27 +00:00
memory.c
printf.c
qsort.c
rand.c
readline.c payloads: Fix typos 2020-02-17 16:01:50 +00:00
string.c payloads: Fix typos 2020-02-17 16:01:50 +00:00
strlcpy.c
sysinfo.c
time.c