libpayload: Support unaligned pointer for memcpy, memmove and memcmp

Hardware / Coreboot - Jeremy Compostella [intel.com] - 13 July 2017 14:16 EDT

The memcpy(), memmove() and memcmp() functions use word by word operations regardless of the pointer alignment. Depending on the platform, this could lead to a crash.

This patch makes the memcpy(), memmove() or memcmp() operate byte per byte if they are supplied with unaligned pointers.

Change-Id: I0b668739b7b58d47266f10f2dff2dc9cbf38577e

5b8987a libpayload: Support unaligned pointer for memcpy, memmove and memcmp
payloads/libpayload/libc/memory.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)

Upstream: review.coreboot.org


  • Share