aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSu Hui <[email protected]>2023-11-30 11:40:18 +0800
committerAndrew Morton <[email protected]>2023-12-06 16:12:49 -0800
commit73424d00dc63ba681856e06cfb0a5abbdb62e2b5 (patch)
tree12c03f17fee3fd7cc8c38942919fb3f8e9eed0c7
parentd61d0ab573649789bf9eb909c89a1a193b2e3d10 (diff)
highmem: fix a memory copy problem in memcpy_from_folio
Clang static checker complains that value stored to 'from' is never read. And memcpy_from_folio() only copy the last chunk memory from folio to destination. Use 'to += chunk' to replace 'from += chunk' to fix this typo problem. Link: https://lkml.kernel.org/r/[email protected] Fixes: b23d03ef7af5 ("highmem: add memcpy_to_folio() and memcpy_from_folio()") Signed-off-by: Su Hui <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Ira Weiny <[email protected]> Cc: Jiaqi Yan <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Collingbourne <[email protected]> Cc: Tom Rix <[email protected]> Cc: Tony Luck <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--include/linux/highmem.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 4cacc0e43b51..be20cff4ba73 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -454,7 +454,7 @@ static inline void memcpy_from_folio(char *to, struct folio *folio,
memcpy(to, from, chunk);
kunmap_local(from);
- from += chunk;
+ to += chunk;
offset += chunk;
len -= chunk;
} while (len > 0);