From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F528E7719A for ; Mon, 13 Jan 2025 04:26:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BDF96B007B; Sun, 12 Jan 2025 23:26:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96E086B0083; Sun, 12 Jan 2025 23:26:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85C776B0085; Sun, 12 Jan 2025 23:26:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 69DD56B007B for ; Sun, 12 Jan 2025 23:26:36 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D442946E67 for ; Mon, 13 Jan 2025 04:26:35 +0000 (UTC) X-FDA: 83001142350.10.0739CF4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id F390BA000B for ; Mon, 13 Jan 2025 04:26:33 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736742394; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nGrh0pSPaOy3OsSDbpsUEkXcRfAUVu6QssfNi78qvhg=; b=Hey3U0jUwSBev2zNfG5APCVXcl39jZZM7QHyn9kS83szbtn9zaPHKttnEDuDy2AMqkYyI9 1uWz7h6O/RcMW8xeY1nhmVDdo+P4jDAzTK9t0YpRBaIxcH8ckHEhmc9GVF+NWWvMJuQjC0 J2nawca7JVigPP5eJ2GiXjPbAXxaQx4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736742394; a=rsa-sha256; cv=none; b=ZW6zLNK5W+3W//cB0f+xcNy8yxQOaINRxxXjeB15/ZSsSZMKS4hxxX/VqRdEDsjFb7QUIS Spf66GDJalV8Q3gH+g8264I3lvjYMa6Z08VH5g/ihWJiAdTgdb2cRJdtbOqySC8eSKtbMU 15H8b0z8dJRjNkMwpq884q2Cz0q4k7k= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27190153B; Sun, 12 Jan 2025 20:27:01 -0800 (PST) Received: from [10.163.57.117] (unknown [10.163.57.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DF4E3F673; Sun, 12 Jan 2025 20:26:29 -0800 (PST) Message-ID: Date: Mon, 13 Jan 2025 09:56:29 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/mm/cow: Modify the incorrect checking parameters To: Hao Ge , 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 References: <20250113032858.63670-1-hao.ge@linux.dev> Content-Language: en-US From: Anshuman Khandual In-Reply-To: <20250113032858.63670-1-hao.ge@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Stat-Signature: woxnqasmsdbji5b78hu7zz171q3wgd4q X-Rspamd-Queue-Id: F390BA000B X-Rspam-User: X-HE-Tag: 1736742393-773195 X-HE-Meta: U2FsdGVkX1/SeHo2/imKIK5vRFodEYE5alTNo1FdOfje5M754UvAesHstkshbP9w1MlYXG0OLTFpFkgPFwd9Ogf85BJd+ZqY0SHvaazvPwLBZZ3BVCp7qhV7MYaANizuax8So+AfCoKztLGD8W3D5N/R92CCgVOE1nmstcnoK0qeoiwACIPYpJoJ1CICO/L5mzfGvUor3fkmoH/9KueQcWG0/iszwliZew76F62cMT+tH00IbuaYfkD29tORQd4N6ghBHKQ0m+Ccef2ey9u1L8tJC9n9dg5DKWPI7DWAM8W3GFI5Z+HWBGNSbgQCrs2gFJjyr4FdF4kJt9j7rIkVnzahRCd6wFtl0Nbjamn9fRM/B2OphsEagjHuXS0oioN798un+EBxorgMf34huKjLk12xX72Y1gRFqlh05xMJp+ahWZn5yi/MKus6+yYdDGWv0ea2Uj93SnSXHAXzxEnniQeisxFJvcHpNtVQ9Fz4XPdDAEPYjIR8Lx5HQUYfixX251ydHn2K7KsQcDmQfqxfWiKj2AB8MSNutPuyei+mZAbhZXhZL+UXCfIC1HSKL/RS7jDJfwpqwnA/rI5P6o8QxTu3oQ8AwsU8baIrwSmqH0FVz1By2agI7hxhCl8aHusWYHm7T7hbQeMuCqyS1tKqEN5I4IlaVVAkrgs53I+GkjleUn88vpWZBnXZXEHd6DpGiphC2UT7qP6nPIIun4EAFBtG7rJmN1J9uVtjJmmewTSK5lYESrKBZvO0SP+QRV8EmapP/M/EoHegVokuOnldEJm0G/J1cHBRFucEKwLupzJLg9SCizIe37ZnKXEPvti1+L9nkXOm9tbqwFqJDMRlyP2rTN4L1fehqBzXGGBDKn5e/IovcrAe5iBNpz+InrsZmWwLi8Tu1PtcbbD0KiCp4J7Rlt9TNA8jsPP7/gNXR7Yj1vIZbEMeFP3SrVTtQydAzjb9n5Sc7P5Ihpe5u5+ JUUmgIUs H39b/GGP4lHZ43+R9aLSMbqWFvOKguKk5qjomO6D7kdvdAgSC4MPLMOQK/mzTos/aCP41zL+CLa3/DDaUspU6IEXLY/kHxwxbWHd9BuZ8jnN8PN+9qpUYrpD5dqO5R3LJZA3V1/kE3oi9J0c= 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: Hello Hao, On 1/13/25 08:58, Hao Ge wrote: > From: Hao Ge > > In the run_with_memfd_hugetlb function, some error handle > have passed incorrect parameters. > It should be "smem", but it was mistakenly written as "mem". I guess there are couple of more instances where the returned address 'smem' is not getting tested for MAP_FAILED. Hence the commit message here needs to be bit more generic rather than run_with_memfd_hugetlb() specific. --- 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; } > > Let's fix it. > > Fixes: baa489fabd01 ("selftests/vm: rename selftests/vm to selftests/mm") This commit just renamed the directory from vm/ to mm/ directory. The following commit introduced the problem instead. Please update the Fixes: tag as required. f8664f3c4a08f799 ("selftests/vm: cow: basic COW tests for non-anonymous pages") > Signed-off-by: Hao Ge > --- > tools/testing/selftests/mm/cow.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c > index 32c6ccc2a6be..7a89680d1566 100644 > --- a/tools/testing/selftests/mm/cow.c > +++ b/tools/testing/selftests/mm/cow.c > @@ -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);