diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-03-26 13:35:23 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-22 08:50:41 +0200 |
commit | 801aa7c355702efe2a6e505d59431980099a1f14 (patch) | |
tree | 4f3fe2a4c66f6114349fadd9b5d664ae4dfac5e9 /payloads/libpayload | |
parent | ee426cf54eea43b8fb5194abe948f8e00d4f4b4c (diff) | |
download | coreboot-801aa7c355702efe2a6e505d59431980099a1f14.tar.xz |
libpayload: fix a mips memmove() bug
size_t is an unsigned type and as such is a bad choice for a counting
down loop counter.
BRANCH=all
BUG=none
TEST=editing cli command line does not cause hangs any more
Change-Id: I0502553b5e2143052345edeb205a01558fccd9b8
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 1c171f739497fcd26589976676ab94b23cd7ee8b
Original-Change-Id: I4aa38379ac356114fc91a32cced2fa45a00a09d6
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/262714
Original-Reviewed-by: Ionela Voinescu <ionela.voinescu@imgtec.com>
Original-Tested-by: Ionela Voinescu <ionela.voinescu@imgtec.com>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/9891
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r-- | payloads/libpayload/arch/mips/string.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/payloads/libpayload/arch/mips/string.c b/payloads/libpayload/arch/mips/string.c index 0563cf82ac..6326d15994 100644 --- a/payloads/libpayload/arch/mips/string.c +++ b/payloads/libpayload/arch/mips/string.c @@ -47,11 +47,10 @@ void *memmove(void *dest, const void *src, size_t n) if ((src < dest) && (dest - src < n)) { u8 *ptr_d = dest; const u8 *ptr_s = src; - size_t i; /* copy backwards */ - for (i = n - 1; i >= 0; i--) - ptr_d[i] = ptr_s[i]; + while (n--) + ptr_d[n] = ptr_s[n]; return dest; } |