diff options
author | Michal Simek <michal.simek@xilinx.com> | 2013-01-16 12:53:22 -0500 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2013-02-12 05:24:44 -0500 |
commit | 1de9e46c21298f85820e004bce103858bc9c9dcb (patch) | |
tree | 5a2b898aceffc2b8d61d5227a4238563a177783b /arch/microblaze | |
parent | 836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff) |
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/microblaze')
-rw-r--r-- | arch/microblaze/lib/uaccess_old.S | 9 |
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: | |||
38 | addik r3,r7,0 /* temp_count = len */ | 38 | addik r3,r7,0 /* temp_count = len */ |
39 | 1: | 39 | 1: |
40 | lbu r4,r6,r0 | 40 | lbu r4,r6,r0 |
41 | beqid r4,2f | ||
41 | sb r4,r5,r0 | 42 | sb r4,r5,r0 |
42 | 43 | ||
43 | addik r3,r3,-1 | ||
44 | beqi r3,2f /* break on len */ | ||
45 | |||
46 | addik r5,r5,1 | 44 | addik r5,r5,1 |
47 | bneid r4,1b | ||
48 | addik r6,r6,1 /* delay slot */ | 45 | addik r6,r6,1 /* delay slot */ |
49 | addik r3,r3,1 /* undo "temp_count--" */ | 46 | |
47 | addik r3,r3,-1 | ||
48 | bnei r3,1b /* break on len */ | ||
50 | 2: | 49 | 2: |
51 | rsubk r3,r3,r7 /* temp_count = len - temp_count */ | 50 | rsubk r3,r3,r7 /* temp_count = len - temp_count */ |
52 | 3: | 51 | 3: |