saner calling conventions for csum_and_copy_..._user()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 11 Jul 2020 04:27:49 +0000 (00:27 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 20 Aug 2020 19:45:15 +0000 (15:45 -0400)
commitc693cc4676a055c4126e487b30b0a96ea7ec9936
tree8f057e3923deeffd1405e40e7ab1c056fa204189
parent99a2c96d52d312b11a943372964226fa134de3b1
saner calling conventions for csum_and_copy_..._user()

All callers of these primitives will
* discard anything we might've copied in case of error
* ignore the csum value in case of error
* always pass 0xffffffff as the initial sum, so the
resulting csum value (in case of success, that is) will never be 0.

That suggest the following calling conventions:
* don't pass err_ptr - just return 0 on error.
* don't bother with zeroing destination, etc. in case of error
* don't pass the initial sum - just use 0xffffffff.

This commit does the minimal conversion in the instances of csum_and_copy_...();
the changes of actual asm code behind them are done later in the series.
Note that this asm code is often shared with csum_partial_copy_nocheck();
the difference is that csum_partial_copy_nocheck() passes 0 for initial
sum while csum_and_copy_..._user() pass 0xffffffff.  Fortunately, we are
free to pass 0xffffffff in all cases and subsequent patches will use that
freedom without any special comments.

A part that could be split off: parisc and uml/i386 claimed to have
csum_and_copy_to_user() instances of their own, but those were identical
to the generic one, so we simply drop them.  Not sure if it's worth
a separate commit...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
19 files changed:
arch/alpha/include/asm/checksum.h
arch/alpha/lib/csum_partial_copy.c
arch/arm/include/asm/checksum.h
arch/m68k/include/asm/checksum.h
arch/m68k/lib/checksum.c
arch/mips/include/asm/checksum.h
arch/parisc/include/asm/checksum.h
arch/powerpc/include/asm/checksum.h
arch/powerpc/lib/checksum_wrappers.c
arch/sh/include/asm/checksum_32.h
arch/sparc/include/asm/checksum_32.h
arch/sparc/include/asm/checksum_64.h
arch/x86/include/asm/checksum_32.h
arch/x86/include/asm/checksum_64.h
arch/x86/lib/csum-wrappers_64.c
arch/x86/um/asm/checksum_32.h
arch/xtensa/include/asm/checksum.h
include/net/checksum.h
lib/iov_iter.c