Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp48142rdb; Wed, 29 Nov 2023 19:40:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuxe2gGxBag7rZW0vS9FOJcK/2EZdjxIejDMJM3Q1lpktvV3ebjoBQ0XcbAeujl9v46bBw X-Received: by 2002:a05:6830:1d69:b0:6d3:3eed:b3e3 with SMTP id l9-20020a0568301d6900b006d33eedb3e3mr23633378oti.8.1701315655348; Wed, 29 Nov 2023 19:40:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701315655; cv=none; d=google.com; s=arc-20160816; b=zUtMWpuZXOg77uI5rJFoPOP7TjpK7hPsb2a2AEX56D+2++qaLfou9N0PiZWxC92t0T wjZONjOtDQZdrxj9AMFJYxJECnCXNTk9t80yscyEDo9YBo3MeYH2+xyZEpcBgdQD8X2j e6iefllFs6VOH+EMU+Y5j+iLIJMzM+aiLVLt2aI2vL9mZtATz4k58KE6GQ2DJXSxAHVO 6aLP+9LXYJAHCJ/fPGH8dPDLhvIkTsPKv/ZehBwEXW469MAqHSLxJNCbfkAKOVpGMkde 7p+drJD4ILU8e8YCB8khaIHffBlOPMJ5mJQsAgbvAg3ekc52kT1Dj8J3H1PpJcRcimHe NRag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mKsa7x4toFi+GwdQToIxR93Cf/ngOnikzz7QSyyrgpI=; fh=NfV2005Bz5DlKLJi6/P1p0PGTzH7+12h955a5ve3gH4=; b=mpQtEQnDvPa6AMjGwE5TmS737VCco9xfB3KaZp+vA4Gv/ZQv6qDUbeiw6mJxjk9a6u y+m8KB5YX72IyIrsR6q/flHqKaOJmBXShpA9TN1lqjmJX7pWBNjgAWA2xlWKfBXdftdB J3+9NNEC8LHMy9bUpjGZufiIgVt4DVE4jylkbuev8UK67UWAJGimJT0pZFt62DiXis42 BwHRogee3lsx9BMT+kVY5Se7pyQGh8e1REdh8j2iL/YTfyUjjvhRajPjanVyQhlQqoig yP1YHE3kjZbnIDFnPvKVekyVQdZU7D3tIYw+gZGHCZgyIXsqcraJQbfsEyDseWKTsN6o 5rDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y64-20020a636443000000b005c5e21f7c3bsi378005pgb.250.2023.11.29.19.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 19:40:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DEF5880490A5; Wed, 29 Nov 2023 19:40:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbjK3Dkj (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 19:40:53 -0800 (PST) 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 += chunk' to replace 'from += chunk' to fix this typo problem. Fixes: b23d03ef7af5 ("highmem: add memcpy_to_folio() and memcpy_from_folio()") Signed-off-by: Su Hui --- 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 folio *folio, memcpy(to, from, chunk); kunmap_local(from); - from += chunk; + to += chunk; offset += chunk; len -= chunk; } while (len > 0); -- 2.30.2