diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-07-20 17:09:24 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-08-20 22:45:22 +0300 |
commit | 70d65cd555c5e43c613700f604a47f7ebcf7b6f1 (patch) | |
tree | 5c0494b0c4bec1c753e158cf7b25e9f1ead37088 /arch/powerpc/lib/checksum_wrappers.c | |
parent | daf52375c19feb4397cfd883302a7c907de2d6ad (diff) | |
download | linux-70d65cd555c5e43c613700f604a47f7ebcf7b6f1.tar.xz |
ppc: propagate the calling conventions change down to csum_partial_copy_generic()
... and get rid of the pointless fallback in the wrappers. On error it used
to zero the unwritten area and calculate the csum of the entire thing. Not
wanting to do it in assembler part had been very reasonable; doing that in
the first place, OTOH... In case of an error the caller discards the data
we'd copied, along with whatever checksum it might've had.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/powerpc/lib/checksum_wrappers.c')
-rw-r--r-- | arch/powerpc/lib/checksum_wrappers.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/arch/powerpc/lib/checksum_wrappers.c b/arch/powerpc/lib/checksum_wrappers.c index b1faa82dd8af..b895166afc82 100644 --- a/arch/powerpc/lib/checksum_wrappers.c +++ b/arch/powerpc/lib/checksum_wrappers.c @@ -14,8 +14,7 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst, int len) { - unsigned int csum; - int err = 0; + __wsum csum; might_sleep(); @@ -24,27 +23,16 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst, allow_read_from_user(src, len); - csum = csum_partial_copy_generic((void __force *)src, dst, - len, ~0U, &err, NULL); - - if (unlikely(err)) { - int missing = __copy_from_user(dst, src, len); - - if (missing) - csum = 0; - else - csum = csum_partial(dst, len, ~0U); - } + csum = csum_partial_copy_generic((void __force *)src, dst, len); prevent_read_from_user(src, len); - return (__force __wsum)csum; + return csum; } EXPORT_SYMBOL(csum_and_copy_from_user); __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len) { - unsigned int csum; - int err = 0; + __wsum csum; might_sleep(); if (unlikely(!access_ok(dst, len))) @@ -52,17 +40,9 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len) allow_write_to_user(dst, len); - csum = csum_partial_copy_generic(src, (void __force *)dst, - len, ~0U, NULL, &err); - - if (unlikely(err)) { - csum = csum_partial(src, len, ~0U); - - if (copy_to_user(dst, src, len)) - csum = 0; - } + csum = csum_partial_copy_generic(src, (void __force *)dst, len); prevent_write_to_user(dst, len); - return (__force __wsum)csum; + return csum; } EXPORT_SYMBOL(csum_and_copy_to_user); |