Blob Blame History Raw
From: Alexander Gordeev <agordeev@linux.ibm.com>
Date: Fri, 15 Jul 2022 12:59:33 +0200
Subject: s390/crash: fix incorrect number of bytes to copy to user space
Git-commit: f6749da17a34eb08c9665f072ce7c812ff68aad2
Patch-mainline: v6.0-rc1
References: git-fixes

The number of bytes in a chunk is correctly calculated, but instead
the total number of bytes is passed to copy_to_user_real() function.

Reported-by: Matthew Wilcox <willy@infradead.org>
Fixes: df9694c7975f ("s390/dump: streamline oldmem copy functions")
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/s390/kernel/crash_dump.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -197,7 +197,7 @@ static int copy_oldmem_user(void __user
 			} else {
 				len = count;
 			}
-			rc = copy_to_user_real(dst, (void *) from, count);
+			rc = copy_to_user_real(dst, (void *) from, len);
 			if (rc)
 				return rc;
 		}