Skip to content

Commit 66aa388

Browse files
author
Al Viro
committed
m68k: get rid of zeroing destination on error in csum_and_copy_from_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1d60be3 commit 66aa388

1 file changed

Lines changed: 15 additions & 64 deletions

File tree

‎arch/m68k/lib/checksum.c‎

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -236,82 +236,33 @@ csum_and_copy_from_user(const void __user *src, void *dst, int len)
236236
"clrl %5\n\t"
237237
"addxl %5,%0\n\t" /* add X bit */
238238
"7:\t"
239-
"clrl %5\n" /* no error - clear return value */
240-
"8:\n"
241239
".section .fixup,\"ax\"\n"
242240
".even\n"
243-
/* If any exception occurs zero out the rest.
244-
Similarities with the code above are intentional :-) */
241+
/* If any exception occurs, return 0 */
245242
"90:\t"
246-
"clrw %3@+\n\t"
247-
"movel %1,%4\n\t"
248-
"lsrl #5,%1\n\t"
249-
"jeq 1f\n\t"
250-
"subql #1,%1\n"
251-
"91:\t"
252-
"clrl %3@+\n"
253-
"92:\t"
254-
"clrl %3@+\n"
255-
"93:\t"
256-
"clrl %3@+\n"
257-
"94:\t"
258-
"clrl %3@+\n"
259-
"95:\t"
260-
"clrl %3@+\n"
261-
"96:\t"
262-
"clrl %3@+\n"
263-
"97:\t"
264-
"clrl %3@+\n"
265-
"98:\t"
266-
"clrl %3@+\n\t"
267-
"dbra %1,91b\n\t"
268-
"clrw %1\n\t"
269-
"subql #1,%1\n\t"
270-
"jcc 91b\n"
271-
"1:\t"
272-
"movel %4,%1\n\t"
273-
"andw #0x1c,%4\n\t"
274-
"jeq 1f\n\t"
275-
"lsrw #2,%4\n\t"
276-
"subqw #1,%4\n"
277-
"99:\t"
278-
"clrl %3@+\n\t"
279-
"dbra %4,99b\n\t"
280-
"1:\t"
281-
"andw #3,%1\n\t"
282-
"jeq 9f\n"
283-
"100:\t"
284-
"clrw %3@+\n\t"
285-
"tstw %1\n\t"
286-
"jeq 9f\n"
287-
"101:\t"
288-
"clrb %3@+\n"
289-
"9:\t"
290-
#define STR(X) STR1(X)
291-
#define STR1(X) #X
292-
"moveq #-" STR(EFAULT) ",%5\n\t"
293-
"jra 8b\n"
243+
"clrl %0\n"
244+
"jra 7b\n"
294245
".previous\n"
295246
".section __ex_table,\"a\"\n"
296247
".long 10b,90b\n"
297-
".long 11b,91b\n"
298-
".long 12b,92b\n"
299-
".long 13b,93b\n"
300-
".long 14b,94b\n"
301-
".long 15b,95b\n"
302-
".long 16b,96b\n"
303-
".long 17b,97b\n"
304-
".long 18b,98b\n"
305-
".long 19b,99b\n"
306-
".long 20b,100b\n"
307-
".long 21b,101b\n"
248+
".long 11b,90b\n"
249+
".long 12b,90b\n"
250+
".long 13b,90b\n"
251+
".long 14b,90b\n"
252+
".long 15b,90b\n"
253+
".long 16b,90b\n"
254+
".long 17b,90b\n"
255+
".long 18b,90b\n"
256+
".long 19b,90b\n"
257+
".long 20b,90b\n"
258+
".long 21b,90b\n"
308259
".previous"
309260
: "=d" (sum), "=d" (len), "=a" (src), "=a" (dst),
310261
"=&d" (tmp1), "=d" (tmp2)
311262
: "0" (sum), "1" (len), "2" (src), "3" (dst)
312263
);
313264

314-
return tmp2 ? 0 : sum;
265+
return sum;
315266
}
316267

317268
EXPORT_SYMBOL(csum_and_copy_from_user);

0 commit comments

Comments
 (0)