s390/crash: make copy_oldmem_page() return number of bytes copied
authorAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 9 Jun 2022 19:32:39 +0000 (21:32 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 23 Jun 2022 15:23:30 +0000 (17:23 +0200)
Callback copy_oldmem_page() returns either error code or zero.
Instead, it should return the error code or number of bytes copied.

Fixes: f65379ecb51f ("s390/dump: streamline oldmem copy functions")
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/crash_dump.c

index 2534a31d25502a90dcf40b7821511567850b72c1..28124d0fa1d5e8839dc9a776f6739ca6b81950fb 100644 (file)
@@ -233,9 +233,10 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
                rc = copy_oldmem_user(iter->iov->iov_base, src, csize);
        else
                rc = copy_oldmem_kernel(iter->kvec->iov_base, src, csize);
-       if (!rc)
-               iov_iter_advance(iter, csize);
-       return rc;
+       if (rc < 0)
+               return rc;
+       iov_iter_advance(iter, csize);
+       return csize;
 }
 
 /*