CBFS: Use memmove instead of memcpy when loading a file from CBFS.
It might be the case that a file is being loaded from a portion of CBFS which has already been loaded into a limitted bit of memory somewhere, and we want to load that file in place, effectively, so that it's original location in CBFS overlaps with its new location. That's only guaranteed to work if you use memmove instead of memcpy. Change-Id: Id550138c875907749fff05f330fcd2fb5f9ed924 Signed-off-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/3577 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
630e4e8c7e
commit
c6b44162f5
|
@ -122,6 +122,9 @@ endif
|
||||||
ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
|
ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
|
||||||
smm-y += memcpy.c
|
smm-y += memcpy.c
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CONFIG_HAVE_ARCH_MEMMOVE),y)
|
||||||
|
smm-y += memmove.c
|
||||||
|
endif
|
||||||
smm-y += cbfs.c memcmp.c
|
smm-y += cbfs.c memcmp.c
|
||||||
smm-$(CONFIG_CONSOLE_SERIAL8250) += uart8250.c
|
smm-$(CONFIG_CONSOLE_SERIAL8250) += uart8250.c
|
||||||
smm-$(CONFIG_CONSOLE_SERIAL8250MEM) += uart8250mem.c
|
smm-$(CONFIG_CONSOLE_SERIAL8250MEM) += uart8250mem.c
|
||||||
|
|
|
@ -195,7 +195,7 @@ int cbfs_decompress(int algo, void *src, void *dst, int len)
|
||||||
{
|
{
|
||||||
switch (algo) {
|
switch (algo) {
|
||||||
case CBFS_COMPRESS_NONE:
|
case CBFS_COMPRESS_NONE:
|
||||||
memcpy(dst, src, len);
|
memmove(dst, src, len);
|
||||||
return 0;
|
return 0;
|
||||||
#ifdef CBFS_CORE_WITH_LZMA
|
#ifdef CBFS_CORE_WITH_LZMA
|
||||||
case CBFS_COMPRESS_LZMA:
|
case CBFS_COMPRESS_LZMA:
|
||||||
|
|
Loading…
Reference in New Issue