diff options
author | Gerald Schaefer <geraldsc@de.ibm.com> | 2006-03-08 00:55:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-08 17:14:01 -0500 |
commit | 331c46591414f7f92b1cec048009abe89892ee79 (patch) | |
tree | ce19fbf200bcef3d0802f59fb5aed5b17005c089 | |
parent | e96fb230cc97760e448327c0de612cfba94ca7bf (diff) |
[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: Gerald Schaefer <geraldsc@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/s390/lib/uaccess.S | 6 | ||||
-rw-r--r-- | arch/s390/lib/uaccess64.S | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S index 88fc94fe6488..5d59e2625048 100644 --- a/arch/s390/lib/uaccess.S +++ b/arch/s390/lib/uaccess.S | |||
@@ -198,12 +198,12 @@ __strnlen_user_asm: | |||
198 | 0: srst %r2,%r1 | 198 | 0: srst %r2,%r1 |
199 | jo 0b | 199 | jo 0b |
200 | sacf 0 | 200 | sacf 0 |
201 | jh 1f # \0 found in string ? | ||
202 | ahi %r2,1 # strnlen_user result includes the \0 | 201 | ahi %r2,1 # strnlen_user result includes the \0 |
203 | 1: slr %r2,%r3 | 202 | # or return count+1 if \0 not found |
203 | slr %r2,%r3 | ||
204 | br %r14 | 204 | br %r14 |
205 | 2: sacf 0 | 205 | 2: sacf 0 |
206 | lhi %r2,-EFAULT | 206 | slr %r2,%r2 # return 0 on exception |
207 | br %r14 | 207 | br %r14 |
208 | .section __ex_table,"a" | 208 | .section __ex_table,"a" |
209 | .long 0b,2b | 209 | .long 0b,2b |
diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S index 50219786fc7a..19b41a33c230 100644 --- a/arch/s390/lib/uaccess64.S +++ b/arch/s390/lib/uaccess64.S | |||
@@ -194,12 +194,12 @@ __strnlen_user_asm: | |||
194 | 0: srst %r2,%r1 | 194 | 0: srst %r2,%r1 |
195 | jo 0b | 195 | jo 0b |
196 | sacf 0 | 196 | sacf 0 |
197 | jh 1f # \0 found in string ? | ||
198 | aghi %r2,1 # strnlen_user result includes the \0 | 197 | aghi %r2,1 # strnlen_user result includes the \0 |
199 | 1: slgr %r2,%r3 | 198 | # or return count+1 if \0 not found |
199 | slgr %r2,%r3 | ||
200 | br %r14 | 200 | br %r14 |
201 | 2: sacf 0 | 201 | 2: sacf 0 |
202 | lghi %r2,-EFAULT | 202 | slgr %r2,%r2 # return 0 on exception |
203 | br %r14 | 203 | br %r14 |
204 | .section __ex_table,"a" | 204 | .section __ex_table,"a" |
205 | .quad 0b,2b | 205 | .quad 0b,2b |