From patchwork Thu Jan 9 17:38:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856088 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A02218DF73; Thu, 9 Jan 2025 17:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444352; cv=pass; b=c72+Cn41N8f9uybbKJvWH3E0KEz9Kjk/OfGh5bbzC+ElLEibiRZiv1VVSPzgpYrBzOReCvknZmwfTvLhhUfast9Vxildf2SJPPNx9qZsWfG1zez7TbE2t9AJRyv7BHz1bzHj3oKkZ37Kl5RC6gRhnCtAI75RAfnDWOsri3HN1iI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444352; c=relaxed/simple; bh=bFLV6Ot3C3ebwBtAJz3dRZHLj/g5QE8DOuamij2Ywe0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HRYO8MSwVfazLg33YQgBeXyQF1vJ2A4PfZGS+B4MYCkrF9nuoHCBLSatLbKLOXMafb/RS3BYGAPiOc7Fcvc4V33eYw00QLoY8r4hArBqDwzpimhJaAIUU8S5suWAWEHpLdek8nnEuUU2KyyyQr2UEVxWHg4jvLXgcWp6oy8NYX8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=gl1Q3WgO; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="gl1Q3WgO" ARC-Seal: i=1; a=rsa-sha256; t=1736444333; cv=none; d=zohomail.com; s=zohoarc; b=apwhxndeqDHgaqQNLHJKVCQ+hxYR+oI6HYu05Pigyw566JaI7zAYmypd6lIL+zDGvg9tPrhxR8FDXx3tauPDnt9Piu0+TL4vM4zXM6uZr1JQjHEKtCy0F5SkT9QgL6Vqoc5wdQc82uPhA9kNCl1v965T+bwn+iELGYc1MiSx8Xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444333; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=JeU06unvxMwqmD+RVXrBS+6nxgmgOdhK5Xdrp6nR3mU=; b=IsCUZ8XTcOqw4KrCcDJZgc0MWXtgHxSkxUo3c/ko1ameuAqSr9QSe3t4aPn/nzrJOMUVa5WlHxsJR9MHrUX5QFp47p7F+qSRKAZY73M93/pJtV4zjlJjbJ9ch1YfRl97iV/JuPLaa0ggT3QPMOvd5AU5gFE+OItsYgWY0uget3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444333; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Reply-To; bh=JeU06unvxMwqmD+RVXrBS+6nxgmgOdhK5Xdrp6nR3mU=; b=gl1Q3WgOuNZzLoBblXAbbFsZoNjLVNka14ePbrpJXrwL1v5frHyboOAJv6BPNt5C FHIh0oFDBvaBnXnIV50BZvEwb16zyISMYJHYson+jnsjxwq9IR+bRpyST3PHAsvIo8x Lg1gjw2FDFC5SiY+FhBqIyClXOSl3r4/6VDl2DdA= Received: by mx.zohomail.com with SMTPS id 1736444332163303.84388479702955; Thu, 9 Jan 2025 09:38:52 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 01/16] selftests/mm: remove argc and argv unused parameters Date: Thu, 9 Jan 2025 22:38:27 +0500 Message-Id: <20250109173842.1142376-2-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Remove the following warnings by removing unused argc and argv parameters: In function ‘main’: warning: unused parameter ‘argc’ [-Wunused-parameter] 158 | int main(int argc, char *argv[]) | ~~~~^~~~ warning: unused parameter ‘argv’ [-Wunused-parameter] 158 | int main(int argc, char *argv[]) | ~~~~~~^~~~~~ Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/compaction_test.c | 2 +- tools/testing/selftests/mm/cow.c | 2 +- tools/testing/selftests/mm/droppable.c | 2 +- tools/testing/selftests/mm/gup_longterm.c | 2 +- tools/testing/selftests/mm/hugepage-vmemmap.c | 2 +- tools/testing/selftests/mm/hugetlb-madvise.c | 2 +- tools/testing/selftests/mm/hugetlb-soft-offline.c | 2 +- tools/testing/selftests/mm/madv_populate.c | 2 +- tools/testing/selftests/mm/map_populate.c | 2 +- tools/testing/selftests/mm/memfd_secret.c | 2 +- tools/testing/selftests/mm/mlock-random-test.c | 2 +- tools/testing/selftests/mm/mlock2-tests.c | 2 +- tools/testing/selftests/mm/on-fault-limit.c | 2 +- tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +- tools/testing/selftests/mm/soft-dirty.c | 2 +- tools/testing/selftests/mm/uffd-wp-mremap.c | 2 +- tools/testing/selftests/mm/virtual_address_range.c | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 2c3a0eb6b22d3..8d23b698ce9db 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -194,7 +194,7 @@ int set_zero_hugepages(unsigned long *initial_nr_hugepages) return ret; } -int main(int argc, char **argv) +int main(void) { struct rlimit lim; struct map_list *list = NULL, *entry; diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index 1238e1c5aae15..ea00c85c76caa 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -1769,7 +1769,7 @@ static int tests_per_non_anon_test_case(void) return tests; } -int main(int argc, char **argv) +int main(void) { int err; struct thp_settings default_settings; diff --git a/tools/testing/selftests/mm/droppable.c b/tools/testing/selftests/mm/droppable.c index f3d9ecf96890a..90ea6377810c5 100644 --- a/tools/testing/selftests/mm/droppable.c +++ b/tools/testing/selftests/mm/droppable.c @@ -15,7 +15,7 @@ #include "../kselftest.h" -int main(int argc, char *argv[]) +int main(void) { size_t alloc_size = 134217728; size_t page_size = getpagesize(); diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c index 9423ad439a614..03a31dcb57577 100644 --- a/tools/testing/selftests/mm/gup_longterm.c +++ b/tools/testing/selftests/mm/gup_longterm.c @@ -444,7 +444,7 @@ static int tests_per_test_case(void) return 3 + nr_hugetlbsizes; } -int main(int argc, char **argv) +int main(void) { int i, err; diff --git a/tools/testing/selftests/mm/hugepage-vmemmap.c b/tools/testing/selftests/mm/hugepage-vmemmap.c index df366a4d1b92d..23e97e552057d 100644 --- a/tools/testing/selftests/mm/hugepage-vmemmap.c +++ b/tools/testing/selftests/mm/hugepage-vmemmap.c @@ -87,7 +87,7 @@ static int check_page_flags(unsigned long pfn) return 0; } -int main(int argc, char **argv) +int main(void) { void *addr; unsigned long pfn; diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c index e74107185324f..43f16c12c8e9a 100644 --- a/tools/testing/selftests/mm/hugetlb-madvise.c +++ b/tools/testing/selftests/mm/hugetlb-madvise.c @@ -58,7 +58,7 @@ void read_fault_pages(void *addr, unsigned long nr_pages) } } -int main(int argc, char **argv) +int main(int __attribute__((unused)) argc, char **argv) { unsigned long free_hugepages; void *addr, *addr2; diff --git a/tools/testing/selftests/mm/hugetlb-soft-offline.c b/tools/testing/selftests/mm/hugetlb-soft-offline.c index f086f0e04756f..cb087303f5ed3 100644 --- a/tools/testing/selftests/mm/hugetlb-soft-offline.c +++ b/tools/testing/selftests/mm/hugetlb-soft-offline.c @@ -216,7 +216,7 @@ static void test_soft_offline_common(int enable_soft_offline) enable_soft_offline); } -int main(int argc, char **argv) +int main(void) { ksft_print_header(); ksft_set_plan(2); diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index ef7d911da13e0..c6a3ee56a54a9 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -281,7 +281,7 @@ static int system_has_softdirty(void) #endif } -int main(int argc, char **argv) +int main(void) { int nr_tests = 16; int err; diff --git a/tools/testing/selftests/mm/map_populate.c b/tools/testing/selftests/mm/map_populate.c index 5c8a53869b1bd..0dd849b4affa6 100644 --- a/tools/testing/selftests/mm/map_populate.c +++ b/tools/testing/selftests/mm/map_populate.c @@ -74,7 +74,7 @@ static int child_f(int sock, unsigned long *smap, int fd) return ksft_cnt.ksft_pass; } -int main(int argc, char **argv) +int main(void) { int sock[2], child, ret; FILE *ftmp; diff --git a/tools/testing/selftests/mm/memfd_secret.c b/tools/testing/selftests/mm/memfd_secret.c index 74c911aa3aea9..b9659fa357371 100644 --- a/tools/testing/selftests/mm/memfd_secret.c +++ b/tools/testing/selftests/mm/memfd_secret.c @@ -297,7 +297,7 @@ static void prepare(void) #define NUM_TESTS 6 -int main(int argc, char *argv[]) +int main(void) { int fd; diff --git a/tools/testing/selftests/mm/mlock-random-test.c b/tools/testing/selftests/mm/mlock-random-test.c index 1cd80b0f76c33..0d95d630d0450 100644 --- a/tools/testing/selftests/mm/mlock-random-test.c +++ b/tools/testing/selftests/mm/mlock-random-test.c @@ -236,7 +236,7 @@ static void test_mlock_outof_limit(char *p, int alloc_size) ksft_test_result_pass("%s\n", __func__); } -int main(int argc, char **argv) +int main(void) { char *p = NULL; diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c index 7f0d50fa361dc..358711e8191f7 100644 --- a/tools/testing/selftests/mm/mlock2-tests.c +++ b/tools/testing/selftests/mm/mlock2-tests.c @@ -425,7 +425,7 @@ static void test_mlockall(void) munlockall(); } -int main(int argc, char **argv) +int main(void) { int ret, size = 3 * getpagesize(); void *map; diff --git a/tools/testing/selftests/mm/on-fault-limit.c b/tools/testing/selftests/mm/on-fault-limit.c index 431c1277d83a1..ade160966c926 100644 --- a/tools/testing/selftests/mm/on-fault-limit.c +++ b/tools/testing/selftests/mm/on-fault-limit.c @@ -28,7 +28,7 @@ static void test_limit(void) munlockall(); } -int main(int argc, char **argv) +int main(void) { ksft_print_header(); ksft_set_plan(1); diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c index 1ac8c88098807..249989f8b7a2a 100644 --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c @@ -528,7 +528,7 @@ static void (*pkey_tests[])(void) = { test_pkru_sigreturn }; -int main(int argc, char *argv[]) +int main(void) { int i; diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 8e1462ce05326..7286c90fff1a3 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -187,7 +187,7 @@ static void test_mprotect_file(int pagemap_fd, int pagesize) test_mprotect(pagemap_fd, pagesize, false); } -int main(int argc, char **argv) +int main(void) { int pagemap_fd; int pagesize; diff --git a/tools/testing/selftests/mm/uffd-wp-mremap.c b/tools/testing/selftests/mm/uffd-wp-mremap.c index 2c4f984bd73ca..f548b1e1f197c 100644 --- a/tools/testing/selftests/mm/uffd-wp-mremap.c +++ b/tools/testing/selftests/mm/uffd-wp-mremap.c @@ -331,7 +331,7 @@ static const struct testcase testcases[] = { }, }; -int main(int argc, char **argv) +int main(void) { struct thp_settings settings; int i, j, plan = 0; diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 4042fd878acd7..7993583450766 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -158,7 +158,7 @@ static int validate_complete_va_space(void) return 0; } -int main(int argc, char *argv[]) +int main(void) { char *ptr[NR_CHUNKS_LOW]; char **hptr; From patchwork Thu Jan 9 17:38:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856087 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C6DB191F83; Thu, 9 Jan 2025 17:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444369; cv=pass; b=QY+kTHALOdMP0WkWOgSj4peL+c2fff3mYdWDtgIxXR80eLvari8uudxjtmQVIHk2iBnc1c+E0Z1rdAL/olcnJRUjMpfO9rDYJRBlG0eyuGB31RQeRobehv3LjicUt9vyiS0HY+kyDPtcscaNOlBz4SPv7yk+8lpPK+Iqeous6kA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444369; c=relaxed/simple; bh=dMj0sy0YSVnlCxQmc/t4dFNEI9VrrWmASdc9jq3wOo8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pIhS0itrDWxTnne68o82CepJZ3sKC9cktzWxtcdeYcjqZfzBse2Ifvr9T5aCRLeoNNGipS/nISZMV0PthDs4fA++H/VF+RZMmrBLitB00tHh24HEMyfp6+7xusKUOdcOPppcPEt0UULbW6V9WSJ6zUiG+e8UlErVPbCO8yuAYv8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=jZBwCQLG; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="jZBwCQLG" ARC-Seal: i=1; a=rsa-sha256; t=1736444349; cv=none; d=zohomail.com; s=zohoarc; b=HHkqer9D9jOpYsHxWEyHRpi13jplxxgtYJDH71wMARrdu73i7SG/Bwa2BnWYvhh5j1T1bDGGM81c+M8H/isTROi8mXFAjDjAcTAYH6c4CNY+OTAd62wZ44V26E/4wGjzIsGQmtCvxQuldUR0wUEVcGloHhwKuiD+P0ZstplSFrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444349; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=eJgiI6Vx5zFOc8jFmmCKCG1szUd46kqPcPMGhbEUP04=; b=NEs77iCxdncBgju4MXnwU0ozZeijflfvDge8zUAoe5UCgkq1X3PSJQUpglLYwQD/8l44guCeHnXLzSiJeSg7PBR0VhgPrYur2w+Z4PynY317ysyW/2ytmRnnNNGC+xTmCXeSwGqVwvU2sDh+7tuUqyaTyjk8V8xQLSd5UoQsTnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444349; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=eJgiI6Vx5zFOc8jFmmCKCG1szUd46kqPcPMGhbEUP04=; b=jZBwCQLGCsVNAzEP5uALr00gMia10ZsyrVMFVizansqMMAt9eckT3AfdkjHHKlWi 0uFx9Fbnehzcxvk4GpExok1AWpkkYgfEBO+UzhhOjZxdeyZOnmuObiTXT/kP2miLyw4 eFzMHGY0U8dg8EMFxKnjozg0GX29Kf8d9Yv66s5Y= Received: by mx.zohomail.com with SMTPS id 1736444346808142.8966002616171; Thu, 9 Jan 2025 09:39:06 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 04/16] selftests/mm: Fix type mismatch warnings Date: Thu, 9 Jan 2025 22:38:30 +0500 Message-Id: <20250109173842.1142376-5-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Fix type mismatch warnings in different tests. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/compaction_test.c | 2 +- tools/testing/selftests/mm/gup_longterm.c | 3 ++- tools/testing/selftests/mm/hugetlb_dio.c | 2 +- tools/testing/selftests/mm/hugetlb_fault_after_madv.c | 2 +- tools/testing/selftests/mm/hugetlb_madv_vs_map.c | 2 +- tools/testing/selftests/mm/ksm_functional_tests.c | 6 +++--- tools/testing/selftests/mm/mlock-random-test.c | 4 ++-- tools/testing/selftests/mm/pkey_sighandler_tests.c | 2 +- tools/testing/selftests/mm/soft-dirty.c | 2 +- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 8d23b698ce9db..f6f32a5732e9e 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -134,7 +134,7 @@ int check_compaction(unsigned long mem_free, unsigned long hugepage_size, lseek(fd, 0, SEEK_SET); if (write(fd, init_nr_hugepages, strlen(init_nr_hugepages)) - != strlen(init_nr_hugepages)) { + != (signed long int)strlen(init_nr_hugepages)) { ksft_print_msg("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n", strerror(errno)); goto close_fd; diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c index 03a31dcb57577..7f1b4ad7fcaec 100644 --- a/tools/testing/selftests/mm/gup_longterm.c +++ b/tools/testing/selftests/mm/gup_longterm.c @@ -446,7 +446,8 @@ static int tests_per_test_case(void) int main(void) { - int i, err; + unsigned int i; + int err; pagesize = getpagesize(); nr_hugetlbsizes = detect_hugetlb_page_sizes(hugetlbsizes, diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c index db63abe5ee5e8..62f368d4c8c16 100644 --- a/tools/testing/selftests/mm/hugetlb_dio.c +++ b/tools/testing/selftests/mm/hugetlb_dio.c @@ -63,7 +63,7 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off) memset(buffer, 'A', writesize); /* Write the buffer to the file */ - if (write(fd, buffer, writesize) != (writesize)) { + if (write(fd, buffer, writesize) != (signed int)writesize) { munmap(orig_buffer, h_pagesize); close(fd); ksft_exit_fail_perror("Error writing to file\n"); diff --git a/tools/testing/selftests/mm/hugetlb_fault_after_madv.c b/tools/testing/selftests/mm/hugetlb_fault_after_madv.c index e62f4e1388f26..2b5acb13ee0be 100644 --- a/tools/testing/selftests/mm/hugetlb_fault_after_madv.c +++ b/tools/testing/selftests/mm/hugetlb_fault_after_madv.c @@ -88,7 +88,7 @@ int main(void) MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); - if ((unsigned long)huge_ptr == -1) + if (huge_ptr == MAP_FAILED) ksft_exit_skip("Failed to allocated huge page\n"); pthread_create(&thread1, NULL, madv, NULL); diff --git a/tools/testing/selftests/mm/hugetlb_madv_vs_map.c b/tools/testing/selftests/mm/hugetlb_madv_vs_map.c index 6c326cf3dcf6b..eda38b63e9e8d 100644 --- a/tools/testing/selftests/mm/hugetlb_madv_vs_map.c +++ b/tools/testing/selftests/mm/hugetlb_madv_vs_map.c @@ -100,7 +100,7 @@ int main(void) MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); - if ((unsigned long)huge_ptr == -1) { + if (huge_ptr == MAP_FAILED) { ksft_test_result_fail("Failed to allocate huge page\n"); return KSFT_FAIL; } diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index 66b4e111b5a27..4f96126e4e1f9 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -306,7 +306,7 @@ static void test_unmerge_zero_pages(void) /* Check if ksm_zero_pages is updated correctly after KSM merging */ pages_expected = size / pagesize; - if (pages_expected != get_my_ksm_zero_pages()) { + if ((signed long)pages_expected != get_my_ksm_zero_pages()) { ksft_test_result_fail("'ksm_zero_pages' updated after merging\n"); goto unmap; } @@ -319,7 +319,7 @@ static void test_unmerge_zero_pages(void) /* Check if ksm_zero_pages is updated correctly after unmerging */ pages_expected /= 2; - if (pages_expected != get_my_ksm_zero_pages()) { + if ((signed long)pages_expected != get_my_ksm_zero_pages()) { ksft_test_result_fail("'ksm_zero_pages' updated after unmerging\n"); goto unmap; } @@ -625,7 +625,7 @@ static void test_prot_none(void) { const unsigned int size = 2 * MiB; char *map; - int i; + unsigned int i; ksft_print_msg("[RUN] %s\n", __func__); diff --git a/tools/testing/selftests/mm/mlock-random-test.c b/tools/testing/selftests/mm/mlock-random-test.c index 0d95d630d0450..f410699458f2a 100644 --- a/tools/testing/selftests/mm/mlock-random-test.c +++ b/tools/testing/selftests/mm/mlock-random-test.c @@ -138,7 +138,7 @@ static void test_mlock_within_limit(char *p, int alloc_size) int page_size = 0; getrlimit(RLIMIT_MEMLOCK, &cur); - if (cur.rlim_cur < alloc_size) + if (cur.rlim_cur < (unsigned int)alloc_size) ksft_exit_fail_msg("alloc_size[%d] < %u rlimit,lead to mlock failure\n", alloc_size, (unsigned int)cur.rlim_cur); @@ -204,7 +204,7 @@ static void test_mlock_outof_limit(char *p, int alloc_size) struct rlimit cur; getrlimit(RLIMIT_MEMLOCK, &cur); - if (cur.rlim_cur >= alloc_size) + if (cur.rlim_cur >= (unsigned int)alloc_size) ksft_exit_fail_msg("alloc_size[%d] >%u rlimit, violates test condition\n", alloc_size, (unsigned int)cur.rlim_cur); diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c index cd46528d6c215..89c0f4e090374 100644 --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c @@ -535,7 +535,7 @@ static void (*pkey_tests[])(void) = { int main(void) { - int i; + unsigned int i; ksft_print_header(); ksft_set_plan(ARRAY_SIZE(pkey_tests)); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index b6eb5c4642ce5..68edb2475ccd4 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -77,7 +77,7 @@ static void test_vma_reuse(int pagemap_fd, int pagesize) static void test_hugepage(int pagemap_fd) { char *map; - int i, ret; + unsigned int i, ret; size_t hpage_len = read_pmd_pagesize(); if (!hpage_len) From patchwork Thu Jan 9 17:38:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856086 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF07A198E6D; Thu, 9 Jan 2025 17:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444381; cv=pass; b=UZyuSrBo04UAPOOgHiBQqoiRiM77shOXR523y7PoLYle1orwXYY6U4+wumD8PZQfSLMDWiFUT0Vens6bIzxE+kq4wdfeW2KVjCd9Eq/lNa6oxX6oHdK3uHSaoUz9y3WvcJhnstKHgBLQRZm4Jk9nMuGZJNIfET2A97GixcLm2A4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444381; c=relaxed/simple; bh=ZHEGChUaNaul4Y7oapj44ZB7OWiHuHeZ6Wgsjkj8vM0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TM7erUPz+Z03FdEdWBjO4jRVURUmWS3sGY2ks8o2k6rzlRyz+grpoHFp8Ai1bQD45AsPw/LyL8YHWnxrkCZlYf77oQQwje/QsWYT9RaAh51dqlBlP0RTSfXWt02h/WVze0/hoEDTJtdQr7uXyLZHGTtQYEROS15NaCVOd9mkzqo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=XU/sASa1; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="XU/sASa1" ARC-Seal: i=1; a=rsa-sha256; t=1736444363; cv=none; d=zohomail.com; s=zohoarc; b=GcRTWK8stBDDIx3AFdOF3FC0tL59k7NOZ/YfNMyaUnC+X4d5U0tq7M11m6RxtYTSPrhSv542fV1l+RATOAgW1YdlM66s1wlEzlNPeU9ilQxHhLv8Cj9GauCHVHPfV+1gXfj5ua8uGYEShRs+cv3YJ/BeEFvZz0PWCjrgfn10GsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444363; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ns4Cnzb7SpJKJg+vEktGwwn4CtMu0+tM6En/nkl/o18=; b=HIeETnI+JRyrYG3axVdu04XWKOIIOVK6EAJoXYy+aIiXkvmFm/A8XaFv8u8IKdtCxF+rk0Ws3xmtVPgb7KKLhbuEPfPJxnMLmvXgRN4DWK7BT+Y5zZjc16SX2y+5TfjWJKwRU4icIt0Dir/igpoTRw1rbzenAy39/mDTqdSB+S4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444363; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=Ns4Cnzb7SpJKJg+vEktGwwn4CtMu0+tM6En/nkl/o18=; b=XU/sASa1xATVXTeeB8hh/d7+0vZQ5lAGzXWOEWzpKhC4sNIoFpqSo+akp9eu1Cwq A7BHMKJO//06Zd5vbwFFfrPlnC5e7lFSns9uYNJdfyBxtJMwIBerXgc+Idcb1cTvHF2 wWX9wuwy9o+xj0v/fCN5PPabFf/TJQxsxBFr1jTI= Received: by mx.zohomail.com with SMTPS id 1736444362474197.40330045642895; Thu, 9 Jan 2025 09:39:22 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 07/16] selftests/mm: hmm-tests: Remove always false expressions Date: Thu, 9 Jan 2025 22:38:33 +0500 Message-Id: <20250109173842.1142376-8-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External As default_hsize is unsigned, it is always greater than equal to zero. Remove expression which is checking if it is less than 0. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/hmm-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c index 141bf63cbe05e..3b4db583bd3b6 100644 --- a/tools/testing/selftests/mm/hmm-tests.c +++ b/tools/testing/selftests/mm/hmm-tests.c @@ -796,7 +796,7 @@ TEST_F(hmm, anon_write_hugetlbfs) int ret; default_hsize = file_read_ulong("/proc/meminfo", "Hugepagesize:"); - if (default_hsize < 0 || default_hsize*1024 < default_hsize) + if (default_hsize*1024 < default_hsize) SKIP(return, "Huge page size could not be determined"); default_hsize = default_hsize*1024; /* KB to B */ @@ -1579,7 +1579,7 @@ TEST_F(hmm, compound) /* Skip test if we can't allocate a hugetlbfs page. */ default_hsize = file_read_ulong("/proc/meminfo", "Hugepagesize:"); - if (default_hsize < 0 || default_hsize*1024 < default_hsize) + if (default_hsize*1024 < default_hsize) SKIP(return, "Huge page size could not be determined"); default_hsize = default_hsize*1024; /* KB to B */ From patchwork Thu Jan 9 17:38:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856085 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC19A1B0413; Thu, 9 Jan 2025 17:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444387; cv=pass; b=GazoZ2tLz77+DKVaijKvUc0yeGrgJugir6vyGbwAoiCJecBTm1Euyq+7VKVkpR6MT/wuvNBqQUJMNUU62Q4PJG7E61BK5ghQ/FmMFomy+IBub3idQYNx3Tq8INd98vk1HtSXob0gumB1EffBHoYO8Xvs+i+0x94WSB5JR0qInss= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444387; c=relaxed/simple; bh=sP6Sa6qhxYUKNVv9NaMzHco1K5r8vMv0z+iDxmHq65M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FTU0mP6ENlIgoJGzfWdu7BDk3XAoRYluaZooyaEKaWBeCoaVCEGgVUvJvi0fclRMbQpvgBDDWfUqIQvplH/eUMk9gJ1uStoHwEtUu2tEUYeIqf0j4D7aXryAbOprKovDqS4hAWNGUdY1aOxlSm2zhW1Yh4qTMcwUqcGv7PJN3j8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=GEjQc+1q; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="GEjQc+1q" ARC-Seal: i=1; a=rsa-sha256; t=1736444369; cv=none; d=zohomail.com; s=zohoarc; b=dQCywtZBGitfnS1qwwMPwcZKKj1fcOvWgFyAjsdIOUuQ9DOn70A4XExTpbEyKFV0pZAi1azdlHzgshbb8nqRu0//uMK6R9lUuwGaBC2v1r0SyFsJ6o3ViD8PRcQWHmnQ3cZIxGf2ItfsRUAIuUBMHiYFj/NGE83JaFszncqB/oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444369; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=whETehW2IwIxAg6V15GnWifjsiCvW0cZ8n4HvvwTvLg=; b=MNomiooTbKPn+WmlCmE0PC/5LcShiCufrWplrB0B2zmThdwfttGHYQyEDzth6gUdpFRYT0mku71g6hpYHBh/J/zBsMsZVcd8U/m1roQ852uGKe5xKJR/rTk5NdmbEX88q4i1Dk8ZievNtgAYv1B9xk7iGtGajUpLQUmYb+0DJU8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444369; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=whETehW2IwIxAg6V15GnWifjsiCvW0cZ8n4HvvwTvLg=; b=GEjQc+1qCZ9XenjwXGHFiWjazc7kB1auWHezfrPEIYwjDhXp5wW3Ivn+jWZ6QIk0 P30gaB6q2IBWCRR7EmiaIVhjCjeES7UA23DfDNSl3ya6lDaNIFRh3eeiYa/X5oLc+FB G3ccisZGB5g9LCi7Mo3gBxLPWq2XFAG9sEMFHsAI= Received: by mx.zohomail.com with SMTPS id 1736444367800740.2406611122897; Thu, 9 Jan 2025 09:39:27 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 08/16] selftests/mm: guard-pages: Fix type mismatch warnings Date: Thu, 9 Jan 2025 22:38:34 +0500 Message-Id: <20250109173842.1142376-9-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Fix type mismatch warnings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/guard-pages.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/guard-pages.c b/tools/testing/selftests/mm/guard-pages.c index ece37212a8a2e..fc1165ef2015f 100644 --- a/tools/testing/selftests/mm/guard-pages.c +++ b/tools/testing/selftests/mm/guard-pages.c @@ -142,7 +142,7 @@ TEST_F(guard_pages, basic) const unsigned long NUM_PAGES = 10; const unsigned long page_size = self->page_size; char *ptr; - int i; + unsigned int i; ptr = mmap(NULL, NUM_PAGES * page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); @@ -1044,7 +1044,7 @@ TEST_F(guard_pages, fork_cow) const unsigned long page_size = self->page_size; char *ptr; pid_t pid; - int i; + unsigned int i; /* Map 10 pages. */ ptr = mmap(NULL, 10 * page_size, PROT_READ | PROT_WRITE, From patchwork Thu Jan 9 17:38:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856084 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EBAE19CC20; Thu, 9 Jan 2025 17:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444398; cv=pass; b=hKRCjQR+SN2beaGw2eJyZlbI5adfvFAowQ+PL0OJ/+2+YVUkB99Ap+S35hvZTc+Up7Aqk3dJN1ijS2r8fZ8hoAQpiDcA6ADM77cuFrK3JVSjt8c4cFwNrquFXe3xjPiJHqT9fg0lGoqdcRZ6tMNI8q74Ft3O/NjLYfNxqxlIiKc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444398; c=relaxed/simple; bh=dQGLRo6LBP/A+jdO2tS+HfbLKNzYpYt9Mrgf3Etsg2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U6Rjm5w4Ae1bX9Ms2dOmDPErMhuLn50vq90MMDbysl06JWtN+9HzujrYgf1f+HV/D11SxfopXj1MvMPqAz1ofg1q1W7/l2SJTS00rzt/3Gu0tewtm7cgVZTk8xOOUuGfDSMSn4gmDLbWK/ZgkaVV93hjbSB4cdDD89oezi5N1vQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=ECXrcFQi; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="ECXrcFQi" ARC-Seal: i=1; a=rsa-sha256; t=1736444379; cv=none; d=zohomail.com; s=zohoarc; b=OCqbFvX5wfA/TmAgcrBar5XSYD1cadtxE6wTnaXMAPBMpIMVYwwCuO+1+EkABkKnNKHezDywRDydrFPPTkFZVNdIJsbbLg2QUFlAFMNn4enNeX239Mpm/ojDCRMxPjcDO+K7X4AIK8rbyIWGAywlTxGzDH6PuzYvZ6P8bQXpTtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=oZBjZaOGgfPGxEQUCi97MIL7c/M2e+noWOX5E6dbvzM=; b=NuH+xeXHYQRy4+zh9AHKOa1kfFon6fejdJuRdRrE9GaEM8hPbENhdhKWMGvZZus+24elDN58igzLqfSdAm5EVMLyG/K/Z5+FVzYBmBJTjvVZ78C2IKHY1rSl2f9G+WtwSmivo6ssVhLFdXY1tRh/TOFn8czNXNvQiZyYoq8anb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444379; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=oZBjZaOGgfPGxEQUCi97MIL7c/M2e+noWOX5E6dbvzM=; b=ECXrcFQiBiP0/jq8OCFeJldeTj49vd3vcwTY4r3jqUoK0xOPzLuedKBJrXAjENYi 3xcgifqeiKewbARFJtM35wijNH6ioGakR26VK9Zk2b3rvaBlK6wNXRgmhKIEpqsVWYj /ZZ7MlDeq31L3jOeet+bzP7iZ8Eb6+RewjgOU5U8= Received: by mx.zohomail.com with SMTPS id 1736444378245741.8870123024191; Thu, 9 Jan 2025 09:39:38 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 10/16] selftests/mm: hugepage-vmemmap: fix type mismatch warnings Date: Thu, 9 Jan 2025 22:38:36 +0500 Message-Id: <20250109173842.1142376-11-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Fix type mismatch warnings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/hugepage-vmemmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/hugepage-vmemmap.c b/tools/testing/selftests/mm/hugepage-vmemmap.c index 23e97e552057d..8d30ebfc9b86c 100644 --- a/tools/testing/selftests/mm/hugepage-vmemmap.c +++ b/tools/testing/selftests/mm/hugepage-vmemmap.c @@ -51,7 +51,8 @@ static unsigned long virt_to_pfn(void *addr) static int check_page_flags(unsigned long pfn) { - int fd, i; + int fd; + unsigned int i; unsigned long pageflags; fd = open("/proc/kpageflags", O_RDONLY); From patchwork Thu Jan 9 17:38:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856083 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2CDB191F68; Thu, 9 Jan 2025 17:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444410; cv=pass; b=rYHF8u3kTcfWxfWoWPkGiZxe4/PD0C0i3lPS1edvKhRp1tqjWiEnpSkXYe5yJoJo3Wy0BVBPeGb45ZsUAYo3ePQYaNdbpJwVnTODEf/4bRILMorrqJn7tzW8FJPp6L8JaSbgEfQNhhaNfI3s8PYDu3iz5SPgVCFpMxVePbqTt5s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444410; c=relaxed/simple; bh=Q4x3BwtxxyZmI9YSoZD8jQQvVaV4y2oFeXHasJCKYe8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dmX0O4VkQ38RmzF/xYJ/votyz/TxfXyj5qrtA+4FPk3ptPVaWdukh8/cn9st/Mc6uzXpa7I/PQttsBl46IwN9a/zeUAv+McxJZIC7LxdS2LmlYfzNWzWwv1WJlmSi9Sn0oRUiIy64iWNFMhB8DgCpyzFQyzKmY+YZEAAivQizDc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=JO/5voGX; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="JO/5voGX" ARC-Seal: i=1; a=rsa-sha256; t=1736444390; cv=none; d=zohomail.com; s=zohoarc; b=FI2ZpYM2l2lhH4e/ZoKt+g/s4GJCa4puWKr6Q/8iqSEeXqL8P3ua7YLIb98EGDrUsPuTYuAFMxzPMnVnZiXRSId0OdrQGPVH1Qeh43IuFdtrS9FMxClLFXMWYf1gQIOF+nzHlFRF5KL4Zv6ty7BwwLofHU+QCcsU3eG/m+gBzCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444390; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=rFE3LTCLLZcWDz1roRpcEOSHGmZKQ3KY8sj8JWlAwYo=; b=JzZW+JZQeRsw6idAdw7Xnes1PyvMbbgbY3zN2DJn/SntKedZYSeCT+VE7qyPOy/lpiWeW5Ci+Hcgy1LXw6g74SPtPbmP2OUBKvSBl4q/Jb51UKXKEipl8oEP6zh0BoWeU8ruLTqtUNFnLhxUJavNp4UsIkdCuaDxfTcWMDKz5Hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444390; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=rFE3LTCLLZcWDz1roRpcEOSHGmZKQ3KY8sj8JWlAwYo=; b=JO/5voGX2w0I8SSOy2/ZpKge+LyWYMK4YtdngTqOXAwJ7JdherhUWOJQy/V4sb+6 cyh55owN4fMOGxrGEXdV5nu6nIQdCz9KtvBOvDboghRYJN7AOTVWsOepSOjBmLsj1hy BTGrO39cuFi69MUD1212zJdAsZAaDSPOLSJrvGUc= Received: by mx.zohomail.com with SMTPS id 1736444388075563.3499694648385; Thu, 9 Jan 2025 09:39:48 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 12/16] selftests/mm: khugepaged: Fix type mismatch warnings Date: Thu, 9 Jan 2025 22:38:38 +0500 Message-Id: <20250109173842.1142376-13-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Fix type mismatch warnings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/khugepaged.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c index 8a4d34cce36b2..dde7c7fbbac2c 100644 --- a/tools/testing/selftests/mm/khugepaged.c +++ b/tools/testing/selftests/mm/khugepaged.c @@ -140,7 +140,7 @@ static void get_finfo(const char *dir) exit(EXIT_FAILURE); } if (snprintf(finfo.path, sizeof(finfo.path), "%s/" TEST_FILE, - finfo.dir) >= sizeof(finfo.path)) { + finfo.dir) >= (signed int)sizeof(finfo.path)) { printf("%s: Pathname is too long\n", __func__); exit(EXIT_FAILURE); } @@ -155,7 +155,7 @@ static void get_finfo(const char *dir) /* Find owning device's queue/read_ahead_kb control */ if (snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/uevent", major(path_stat.st_dev), minor(path_stat.st_dev)) - >= sizeof(path)) { + >= (signed int)sizeof(path)) { printf("%s: Pathname is too long\n", __func__); exit(EXIT_FAILURE); } @@ -169,7 +169,7 @@ static void get_finfo(const char *dir) sizeof(finfo.dev_queue_read_ahead_path), "/sys/dev/block/%d:%d/queue/read_ahead_kb", major(path_stat.st_dev), minor(path_stat.st_dev)) - >= sizeof(finfo.dev_queue_read_ahead_path)) { + >= (signed int)sizeof(finfo.dev_queue_read_ahead_path)) { printf("%s: Pathname is too long\n", __func__); exit(EXIT_FAILURE); } @@ -197,7 +197,7 @@ static void get_finfo(const char *dir) if (snprintf(finfo.dev_queue_read_ahead_path, sizeof(finfo.dev_queue_read_ahead_path), "/sys/block/%s/queue/read_ahead_kb", - str) >= sizeof(finfo.dev_queue_read_ahead_path)) { + str) >= (signed int)sizeof(finfo.dev_queue_read_ahead_path)) { printf("%s: Pathname is too long\n", __func__); exit(EXIT_FAILURE); } @@ -271,7 +271,7 @@ static void *alloc_mapping(int nr) static void fill_memory(int *p, unsigned long start, unsigned long end) { - int i; + unsigned int i; for (i = start / page_size; i < end / page_size; i++) p[i * page_size / sizeof(*p)] = i + 0xdead0000; @@ -333,10 +333,10 @@ static void *alloc_hpage(struct mem_ops *ops) static void validate_memory(int *p, unsigned long start, unsigned long end) { - int i; + unsigned int i; for (i = start / page_size; i < end / page_size; i++) { - if (p[i * page_size / sizeof(*p)] != i + 0xdead0000) { + if ((unsigned int)p[i * page_size / sizeof(*p)] != i + 0xdead0000) { printf("Page %d is corrupted: %#x\n", i, p[i * page_size / sizeof(*p)]); exit(EXIT_FAILURE); @@ -537,7 +537,7 @@ static void madvise_collapse(const char *msg, char *p, int nr_hpages, static bool wait_for_scan(const char *msg, char *p, int nr_hpages, struct mem_ops *ops) { - int full_scans; + unsigned int full_scans; int timeout = 6; /* 3 seconds */ /* Sanity check */ From patchwork Thu Jan 9 17:38:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 856082 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A87919306F; Thu, 9 Jan 2025 17:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444426; cv=pass; b=Ms95GArsPt4QfxuJQ12vyfK3cWRilI38Lj3IbQjPkeobylIo3H2A+IGOidBR2tXfRMBAPMJbnGM9wQGSZFbPMgollcMR0WW2x1DIhR5ffVMwKtXesZzYV47cuwrLYwl2Js5SG92kgehWdPCRoQBmJH0cdvQacqNRmJJBbbqgzKo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736444426; c=relaxed/simple; bh=ZfDYeNDp/NbUJRxCeBp2IvOWYJKgrIuO3sZpGkWAb+s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kBc066kvtrtUgxHB67CFd/qrglPcPBcqC+gQdYaOcGNlt+xYQ2XrbSfcY5HiKg/h486ttZ28+Rvt1evlNAtymRx0ipZ4fv7HYc6f0qTSIvjxxwMC7fL1mxn4wo1VvRzZpDZ/rT0fQpZ9jVn9hKNFq2TuVZb5Lg1zGG7lkPghAVs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b=E42plzwo; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=usama.anjum@collabora.com header.b="E42plzwo" ARC-Seal: i=1; a=rsa-sha256; t=1736444408; cv=none; d=zohomail.com; s=zohoarc; b=EA96Fos4BhL2pPCfCvhDOGRlyxxT1MkPpiO4QNlECeC0D28p7B6/iJaOgfw4SgWGglX2Y3XSE/sBz/rAM9McoIjzPo44zNDG+woARIuIduahd6ZpYzJAg9hlBkMU1lUbViy/rjT7Jm6M3z3+mJPFsUezq/hCCHvyvoMTkOTpSvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444408; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=CeHZ22DeRcbYzVqgFrIGCzYTZL3s2f2EUGStcqAuXWw=; b=QoGmpsBPt1rQgSWYA+KTSGfCOR5BggWu1E95AwxFKv4EgsIyMkzPcdWAjvHHhDe1gmMcQs2FaySvML4du+wvgRuDVgFeXtgR3GO3IsMhwMYp8UMdZZYOTjQRIkONbJoEGAeL1hw4xd3sAw05CI7+I4CfHrrENWHUTVZxNqA2ylk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736444408; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=CeHZ22DeRcbYzVqgFrIGCzYTZL3s2f2EUGStcqAuXWw=; b=E42plzwodXz91pjg1bgn90hvwF78JGAIljtjn7PZMAitJ8hRSr2yiIoCeJZsFgJC ckmgDtP4qT/Ry+FpcwT0KsXqI1UKC07vh7upsP+dwKvjCTdLDJKHQaKVJsv952MgqRS /g1yACduicG6hPfMZWQ95JiHapj4goG8W6lmVlBU= Received: by mx.zohomail.com with SMTPS id 1736444406712435.8462214370427; Thu, 9 Jan 2025 09:40:06 -0800 (PST) From: Muhammad Usama Anjum To: Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Muhammad Usama Anjum , kernel@collabora.com Subject: [PATCH 15/16] selftests/mm: uffd-*: Fix all type mismatch warnings Date: Thu, 9 Jan 2025 22:38:41 +0500 Message-Id: <20250109173842.1142376-16-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com> References: <20250109173842.1142376-1-usama.anjum@collabora.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ZohoMailClient: External Fix all type mismatch warnings in all uffd-* files. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/uffd-common.c | 6 +++--- tools/testing/selftests/mm/uffd-stress.c | 2 +- tools/testing/selftests/mm/uffd-unit-tests.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index c15674a60f299..47bdcb47481ae 100644 --- a/tools/testing/selftests/mm/uffd-common.c +++ b/tools/testing/selftests/mm/uffd-common.c @@ -450,7 +450,7 @@ void uffd_handle_page_fault(struct uffd_msg *msg, struct uffd_args *args) args->wp_faults++; } else if (msg->arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_MINOR) { uint8_t *area; - int b; + unsigned int b; /* * Minor page faults @@ -621,7 +621,7 @@ int __copy_page(int ufd, unsigned long offset, bool retry, bool wp) err("UFFDIO_COPY error: %"PRId64, (int64_t)uffdio_copy.copy); wake_range(ufd, uffdio_copy.dst, page_size); - } else if (uffdio_copy.copy != page_size) { + } else if (uffdio_copy.copy != (signed long)page_size) { err("UFFDIO_COPY error: %"PRId64, (int64_t)uffdio_copy.copy); } else { if (test_uffdio_copy_eexist && retry) { @@ -655,7 +655,7 @@ int move_page(int ufd, unsigned long offset, unsigned long len) err("UFFDIO_MOVE error: %"PRId64, (int64_t)uffdio_move.move); wake_range(ufd, uffdio_move.dst, len); - } else if (uffdio_move.move != len) { + } else if (uffdio_move.move != (signed long)len) { err("UFFDIO_MOVE error: %"PRId64, (int64_t)uffdio_move.move); } else return 1; diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index 1270ff3104cc6..5509ec32c3290 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -77,7 +77,7 @@ static void usage(void) static void uffd_stats_reset(struct uffd_args *args, unsigned long n_cpus) { - int i; + unsigned int i; for (i = 0; i < n_cpus; i++) { args[i].cpu = i; diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index 81b315bedb744..c3d59ec754040 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -917,7 +917,7 @@ static bool do_uffdio_zeropage(int ufd, bool has_zeropage) else if (res != -EINVAL) err("UFFDIO_ZEROPAGE not -EINVAL"); } else if (has_zeropage) { - if (res != page_size) + if (res != (signed long)page_size) err("UFFDIO_ZEROPAGE unexpected size"); else retry_uffdio_zeropage(ufd, &uffdio_zeropage); @@ -949,7 +949,7 @@ uffd_register_detect_zeropage(int uffd, void *addr, uint64_t len) static void uffd_zeropage_test(uffd_test_args_t __attribute__((unused)) *args) { bool has_zeropage; - int i; + unsigned int i; has_zeropage = uffd_register_detect_zeropage(uffd, area_dst, page_size); if (area_dst_alias) @@ -997,7 +997,7 @@ static void do_uffdio_poison(int uffd, unsigned long offset) if (ret) err("UFFDIO_POISON error: %"PRId64, (int64_t)res); - else if (res != page_size) + else if (res != (signed long)page_size) err("UFFDIO_POISON unexpected size: %"PRId64, (int64_t)res); }