[PATCH] MIPS: R6: memcpy bugfix - zero length overwrites memory

From: Leonid Yegoshin
Date: Mon Apr 27 2015 - 19:35:43 EST


MIPS R6 version of memcpy has bug - then length to copy is zero
and addresses are not aligned then it can overwrite a whole memory.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@xxxxxxxxxx>
---
arch/mips/lib/memcpy.S | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index 9245e1705e69..7e0250f3aec8 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -514,6 +514,8 @@

#ifdef CONFIG_CPU_MIPSR6
.Lcopy_unaligned_bytes\@:
+ beqz len, .Ldone\@
+ nop
1:
COPY_BYTE(0)
COPY_BYTE(1)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/