Commit 331c4659 authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Linus Torvalds

[PATCH] s390: fix strnlen_user return value

strnlen_user is supposed to return then length count + 1 if no terminating \0
is found, and it should return 0 on exception.  Found by David Howells
<dhowells@redhat.com>.
Signed-off-by: default avatarGerald Schaefer <geraldsc@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Acked-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e96fb230
...@@ -198,12 +198,12 @@ __strnlen_user_asm: ...@@ -198,12 +198,12 @@ __strnlen_user_asm:
0: srst %r2,%r1 0: srst %r2,%r1
jo 0b jo 0b
sacf 0 sacf 0
jh 1f # \0 found in string ?
ahi %r2,1 # strnlen_user result includes the \0 ahi %r2,1 # strnlen_user result includes the \0
1: slr %r2,%r3 # or return count+1 if \0 not found
slr %r2,%r3
br %r14 br %r14
2: sacf 0 2: sacf 0
lhi %r2,-EFAULT slr %r2,%r2 # return 0 on exception
br %r14 br %r14
.section __ex_table,"a" .section __ex_table,"a"
.long 0b,2b .long 0b,2b
......
...@@ -194,12 +194,12 @@ __strnlen_user_asm: ...@@ -194,12 +194,12 @@ __strnlen_user_asm:
0: srst %r2,%r1 0: srst %r2,%r1
jo 0b jo 0b
sacf 0 sacf 0
jh 1f # \0 found in string ?
aghi %r2,1 # strnlen_user result includes the \0 aghi %r2,1 # strnlen_user result includes the \0
1: slgr %r2,%r3 # or return count+1 if \0 not found
slgr %r2,%r3
br %r14 br %r14
2: sacf 0 2: sacf 0
lghi %r2,-EFAULT slgr %r2,%r2 # return 0 on exception
br %r14 br %r14
.section __ex_table,"a" .section __ex_table,"a"
.quad 0b,2b .quad 0b,2b
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment