RE: AW: [PATCH] amd64: Fix csum_partial_copy_generic()

From: David Laight
Date: Sun Oct 22 2023 - 07:03:50 EST


From: Al Viro
> Sent: 21 October 2023 23:22
>
> > I don't think -rc7 is a good time for that, though. At the
> > very least it needs a review on linux-arch - I think I hadn't
> > fucked the ABI for returning u64 up, but...
> >
> > Anyway, completely untested patch follows:
>
> ... and now something that at least builds (with some brainos fixed); it's still
> slightly suboptimal representation on big-endian 32bit - there it would be better to
> have have the csum in upper half of the 64bit getting returned and use the lower
> half as fault indicator, but dealing with that cleanly takes some massage of
> includes in several places, so I'd left that alone for now. In any case, the
> overhead of that is pretty much noise.
>
> diff --git a/arch/alpha/include/asm/checksum.h b/arch/alpha/include/asm/checksum.h
> index 99d631e146b2..80c57b370edb 100644
> --- a/arch/alpha/include/asm/checksum.h
> +++ b/arch/alpha/include/asm/checksum.h
> @@ -43,7 +43,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum);
> */
> #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
> #define _HAVE_ARCH_CSUM_AND_COPY
> -__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len);
> +__u64 csum_and_copy_from_user(const void __user *src, void *dst, int len);
...
> + return -1;

If you are going to return -1 the return type should be signed.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)