summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-01-16 18:53:22 +0100
committerMichal Simek <michal.simek@xilinx.com>2013-02-12 11:24:44 +0100
commit1de9e46c21298f85820e004bce103858bc9c9dcb (patch)
tree5a2b898aceffc2b8d61d5227a4238563a177783b /arch
parent836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff)
downloadlinux-1de9e46c21298f85820e004bce103858bc9c9dcb.tar.gz
linux-1de9e46c21298f85820e004bce103858bc9c9dcb.tar.bz2
linux-1de9e46c21298f85820e004bce103858bc9c9dcb.zip
microblaze: Fix strncpy_from_user macro
Problem happens when len in strncpy_from_user is setup and passing string has len-1 chars + \0 terminated character. In this case was returned incorrect length of the string. It should always retunrs the length of the string (not including the trailing NULL). Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/microblaze/lib/uaccess_old.S9
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/microblaze/lib/uaccess_old.S b/arch/microblaze/lib/uaccess_old.S
index f085995ee848..0e8cc2710c27 100644
--- a/arch/microblaze/lib/uaccess_old.S
+++ b/arch/microblaze/lib/uaccess_old.S
@@ -38,15 +38,14 @@ __strncpy_user:
addik r3,r7,0 /* temp_count = len */
1:
lbu r4,r6,r0
+ beqid r4,2f
sb r4,r5,r0
- addik r3,r3,-1
- beqi r3,2f /* break on len */
-
addik r5,r5,1
- bneid r4,1b
addik r6,r6,1 /* delay slot */
- addik r3,r3,1 /* undo "temp_count--" */
+
+ addik r3,r3,-1
+ bnei r3,1b /* break on len */
2:
rsubk r3,r3,r7 /* temp_count = len - temp_count */
3: