Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/checksum: Fix csum_partial() without vector facility
@ 2026-07-08 10:02 Vasily Gorbik
  2026-07-09  6:08 ` Heiko Carstens
  2026-07-09 10:49 ` Vasily Gorbik
  0 siblings, 2 replies; 3+ messages in thread
From: Vasily Gorbik @ 2026-07-08 10:02 UTC (permalink / raw)
  To: Heiko Carstens, Ilya Leoshkevich
  Cc: Christian Borntraeger, Alexander Gordeev, linux-s390

Currently csum_partial() calls csum_copy() with copy=false and dst=NULL.
On machines without the vector facility, csum_copy() falls back to
cksm(dst, ...), causing the checksum to be calculated from address zero
instead of the source buffer.

The VX implementation already checksums data loaded from src. Make the
fallback do the same by passing src to cksm().

Fixes: dcd3e1de9d17 ("s390/checksum: provide csum_partial_copy_nocheck()")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
 arch/s390/lib/csum-partial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/lib/csum-partial.c b/arch/s390/lib/csum-partial.c
index 458abd9bac70..9d74ceff136c 100644
--- a/arch/s390/lib/csum-partial.c
+++ b/arch/s390/lib/csum-partial.c
@@ -23,7 +23,7 @@ static __always_inline __wsum csum_copy(void *dst, const void *src, int len, __w
 	if (!cpu_has_vx()) {
 		if (copy)
 			memcpy(dst, src, len);
-		return cksm(dst, len, sum);
+		return cksm(src, len, sum);
 	}
 	kernel_fpu_begin(&vxstate, KERNEL_VXR_V16V23);
 	fpu_vlvgf(16, (__force u32)sum, 1);
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-09 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 10:02 [PATCH] s390/checksum: Fix csum_partial() without vector facility Vasily Gorbik
2026-07-09  6:08 ` Heiko Carstens
2026-07-09 10:49 ` Vasily Gorbik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox