lkml.org 
[lkml]   [2015]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] MIPS: R6: memcpy bugfix - zero length overwrites memory
From
Date
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@imgtec.com>
---
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)


\
 
 \ /
  Last update: 2015-04-28 01:41    [W:0.095 / U:2.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site