Skip to content

Commit 1cdc934

Browse files
Su Huigregkh
authored andcommitted
highmem: fix a memory copy problem in memcpy_from_folio
commit 73424d0 upstream. 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/20231130034017.1210429-1-suhui@nfschina.com Fixes: b23d03e ("highmem: add memcpy_to_folio() and memcpy_from_folio()") Signed-off-by: Su Hui <suhui@nfschina.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Ira Weiny <ira.weiny@intel.com> Cc: Jiaqi Yan <jiaqiyan@google.com> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Peter Collingbourne <pcc@google.com> Cc: Tom Rix <trix@redhat.com> Cc: Tony Luck <tony.luck@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 56a3343 commit 1cdc934

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)