From patchwork Mon Jan 13 05:09:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Ge X-Patchwork-Id: 13936741 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70D8DE7719A for ; Mon, 13 Jan 2025 05:10:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB18B6B007B; Mon, 13 Jan 2025 00:10:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3ABE6B0083; Mon, 13 Jan 2025 00:10:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDB2C6B0085; Mon, 13 Jan 2025 00:10:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9F1F46B007B for ; Mon, 13 Jan 2025 00:10:07 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0094F121A91 for ; Mon, 13 Jan 2025 05:10:06 +0000 (UTC) X-FDA: 83001252054.22.7ED8740 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) by imf09.hostedemail.com (Postfix) with ESMTP id 3E131140010 for ; Mon, 13 Jan 2025 05:10:05 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ACoFZwQQ; spf=pass (imf09.hostedemail.com: domain of hao.ge@linux.dev designates 91.218.175.171 as permitted sender) smtp.mailfrom=hao.ge@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736745005; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1l78jd0qMMKBnpeHqnyXlXnFzz9Dvsbdkukvh1fc9lc=; b=2J1QV7FaGc+7gR+I+bwN58XBxd2ktMOMOPj9ANI6u1DXosnyK1Y+vaKczXq5mTGHYQvZba CpbChBvDH9p5IND53IN+Kri+b4CRBdLlvFWZqZwv2yqsBgBWPOyvTpjgu320NzG2xSnGVS WGLm95mlQYROhZa3jiP84DaUg4nl9Oc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ACoFZwQQ; spf=pass (imf09.hostedemail.com: domain of hao.ge@linux.dev designates 91.218.175.171 as permitted sender) smtp.mailfrom=hao.ge@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736745005; a=rsa-sha256; cv=none; b=iVu7Yz91chYjT3PvIMPu0FEOm87GGwBBOovdqdg5C4Zth6HtmYhSKnJLi0F9QQ39L2AqdB 2tXX5HPVTHbAx8OlBACGWa5I+luf/VKSyXa5z4z2vU57JmokyA1+hn1Rbs3HWPes1CKxt/ zMRLXtzX7l3mjtQHZsDqFFSmj5rnlGo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736744998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1l78jd0qMMKBnpeHqnyXlXnFzz9Dvsbdkukvh1fc9lc=; b=ACoFZwQQpdRGjNwYtx0yuCGYY3g7W1LW6ejwb0w8JHnarM2hgBYnylRuLjvzGsWtBfLh4u JCZr8wKMala0bX89MFlWgqSvVcnLjJiTzY4YIB6Lx9PfvGqmape62DVJpldE1glbkvghZ9 /bJ0+S3BVrI4qkucKpYwv9QZi35LBqc= From: Hao Ge To: akpm@linux-foundation.org, shuah@kernel.org Cc: sj@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, hao.ge@linux.dev, Hao Ge Subject: [PATCH v2] selftests/mm/cow: Modify the incorrect checking parameters Date: Mon, 13 Jan 2025 13:09:08 +0800 Message-Id: <20250113050908.93638-1-hao.ge@linux.dev> In-Reply-To: <1514aee8-e75c-4c05-8943-65681254feda@linux.dev> References: <1514aee8-e75c-4c05-8943-65681254feda@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 3E131140010 X-Stat-Signature: 9r8syr14j95bmgcnkzjarwjn5djy4f44 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736745005-605724 X-HE-Meta: U2FsdGVkX198R2Yfyx2XoEy6K9dOJNNiOUQTRPn64bgEVxP0XHyjsGZjIlTf9HpoeYuJTuy2GOzmB8ddj/IS4XzNX3rmE4mQ2pFvquQpxbsBkgCagSGNsGUY6yf6GI8/BtHj3czAt/aiDAsXxsKXSB2FvzOZ4ljQbeeBa0b65Pr4P35NMNEUghIVBHRRC/MPHCYFw4mYhTxEnwz2/lXAtnybUL/AQqM2ZlW58GT6NsMHaqy3lqMZGWfHXbJ/4exTXu/taLoscGOfp6n+1hNlhrrhC3uUAkDq8AekZ99uTf62l+OywZweEf2rILbXyXixOwsYNU//pNQISHHTH4QHkEB9/i2eQrN8/NRMpX6touC4Tzv4vmkWfqTtAKxK9VsLbcJQioSyxpi1LNpLMjevOYlBsVhZZW3ITev/DgymlNqPoxCTAOulSbVTEAZ6+yX9NcTDkaGY+TT95LUg4zNNkqQJ53sJiOjdw/6Xe7Arnm6OGc8QTVPG5fYjnNOExrZC8VJOhhwMVQj3u/jGkqPdWVv9VX0Z23NcjpH7qim7w//TO6ozudJff4KNtR2lxdpd7NitjP0v8hqKMxIhDGQPU+0W3f+XtLasP5MSH54rH5BuCJR8SW46GRvribKwZiFw+uNWGDX3qwzvH9ArafuZ9gmvTdTd1S+2YO65+MwVDnaYqJlgOBpRLnMlVMTKEMosjHulm5idIkuuhGBWpMQGlfbv53422HQb5kFweiu7coRdtZu13ewEgnXmIF/wusTYQFKhEROu0QyJJO+RZo1UwSnKwZDKbcN5XGAD5O8T7ML8VoW6jpdHY6TcYzstwRXYSiatTKz8vI7w/FcMrbPUGeK3XfsqJgpHY8fvn+DXxRDXAQpiNYB6AhChNddtMqfFfEnfzHc0zqMePksgsxCkeLLi0+LO6TXvdohYg+x6GhqisPWFiDRkPLBhWIqUVJ/sZxPhj+8oDTuSi+nPSmM 58MXs0uD gJ2FBZENBTdoQGeeYmdl0CdzolQD+q/nMsGoDMDnOBExM4HsjhaFR/JnTjih48+5GV4gtQsSbCKwKngxJMV58WeY/q8ZCyH2Ry0cZ4ZzyIw0YRD2L0aHVQlXtha8Vxly41FELjeoh9zrXOdo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Hao Ge In the cow.c,some error handle have passed incorrect parameters. It should be "smem", but it was mistakenly written as "mem". Let's fix it. Fixes: f8664f3c4a08 ("selftests/vm: cow: basic COW tests for non-anonymous pages") Signed-off-by: Hao Ge Reviewed-by: Anshuman Khandual Reviewed-by: Dev Jain --- v2: Anshuman pointed out that the error is not limited to the run_with_memfd_hugetlb function; there are other places where it occurs as well. Therefore, let's fix it all together. Similarly, Update the Fix tag to be accurate. --- tools/testing/selftests/mm/cow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index 32c6ccc2a6be..c52c93996ba1 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -1482,7 +1482,7 @@ static void run_with_zeropage(non_anon_test_fn fn, const char *desc) } smem = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); - if (mem == MAP_FAILED) { + if (smem == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); goto munmap; } @@ -1583,7 +1583,7 @@ static void run_with_memfd(non_anon_test_fn fn, const char *desc) goto close; } smem = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0); - if (mem == MAP_FAILED) { + if (smem == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); goto munmap; } @@ -1634,7 +1634,7 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc) goto close; } smem = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0); - if (mem == MAP_FAILED) { + if (smem == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); goto munmap; } @@ -1684,7 +1684,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc, goto close; } smem = mmap(NULL, hugetlbsize, PROT_READ, MAP_SHARED, fd, 0); - if (mem == MAP_FAILED) { + if (smem == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); goto munmap; } @@ -1696,7 +1696,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc, fn(mem, smem, hugetlbsize); munmap: munmap(mem, hugetlbsize); - if (mem != MAP_FAILED) + if (smem != MAP_FAILED) munmap(smem, hugetlbsize); close: close(fd);