Skip to content

Commit

Permalink
microblaze: Fix strncpy_from_user macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michal Simek committed Feb 12, 2013
1 parent 836dc9e commit 1de9e46
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions arch/microblaze/lib/uaccess_old.S
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1de9e46

Please sign in to comment.