riscv: fix integer wraparound in memcpy
This patch fixes a bug in RISC-V's memcpy implementation where an integer wraparound occurs when src + size < 8 * sizeof(long), causing the word-sized copy loop to be incorrectly entered. Signed-off-by: Chih-Mao Chen <cmchen@andestech.com>
This commit is contained in:
parent
0947efb859
commit
123b806523
|
@ -51,9 +51,9 @@ small:
|
|||
const long *lb = (const long *)b;
|
||||
long *lend = (long *)((uintptr_t)end & ~msk);
|
||||
|
||||
if (unlikely (la < (lend - 8)))
|
||||
if (unlikely (lend - la > 8))
|
||||
{
|
||||
while (la < (lend - 8))
|
||||
while (lend - la > 8)
|
||||
{
|
||||
long b0 = *lb++;
|
||||
long b1 = *lb++;
|
||||
|
|
Loading…
Reference in New Issue