Skip to content

Commit 73424d0

Browse files
Su Huiakpm00
authored andcommitted
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: b23d03e ("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]>
1 parent d61d0ab commit 73424d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/highmem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static inline void memcpy_from_folio(char *to, struct folio *folio,
454454
memcpy(to, from, chunk);
455455
kunmap_local(from);
456456

457-
from += chunk;
457+
to += chunk;
458458
offset += chunk;
459459
len -= chunk;
460460
} while (len > 0);

0 commit comments

Comments
 (0)