From nobody Tue Dec 16 09:03:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A886FC4167B for ; Thu, 30 Nov 2023 03:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344316AbjK3Dkj (ORCPT ); Wed, 29 Nov 2023 22:40:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbjK3Dki (ORCPT ); Wed, 29 Nov 2023 22:40:38 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 09B8A10CB; Wed, 29 Nov 2023 19:40:43 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 01182613F8930; Thu, 30 Nov 2023 11:40:33 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com Cc: Su Hui , akpm@linux-foundation.org, willy@infradead.org, fmdefrancesco@gmail.com, ira.weiny@intel.com, tony.luck@intel.com, jiaqiyan@google.com, pcc@google.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH] highmem: fix a memory copy problem in memcpy_from_folio Date: Thu, 30 Nov 2023 11:40:18 +0800 Message-Id: <20231130034017.1210429-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Using 'to +=3D chunk' to replace 'from +=3D chunk' to fix this typo problem. Fixes: b23d03ef7af5 ("highmem: add memcpy_to_folio() and memcpy_from_folio(= )") Signed-off-by: Su Hui Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/highmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f= olio *folio, memcpy(to, from, chunk); kunmap_local(from); =20 - from +=3D chunk; + to +=3D chunk; offset +=3D chunk; len -=3D chunk; } while (len > 0); --=20 2.30.2