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: 13933052 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 ECD9EE77197 for ; Thu, 9 Jan 2025 17:39:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B4FA6B0096; Thu, 9 Jan 2025 12:39:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7651A6B0098; Thu, 9 Jan 2025 12:39:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 605F06B0099; Thu, 9 Jan 2025 12:39:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 42BCD6B0096 for ; Thu, 9 Jan 2025 12:39:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 05594802AF for ; Thu, 9 Jan 2025 17:39:26 +0000 (UTC) X-FDA: 82988625132.10.88F8D19 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by imf05.hostedemail.com (Postfix) with ESMTP id 31E9F100010 for ; Thu, 9 Jan 2025 17:39:23 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=jZBwCQLG; dmarc=pass (policy=none) header.from=collabora.com; spf=pass (imf05.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736444364; 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=eJgiI6Vx5zFOc8jFmmCKCG1szUd46kqPcPMGhbEUP04=; b=FfCMmfLHUKw/3i9q9hwNX/nOxMXOaGff8ZxyMdkP8Z6YtIDlJSGokt8b3syLoLREp5RkMJ ZS2yeehtaFGmorX2dO5/r3QOS8WyuxlU97kkt+06CZyYR8jajIoDVP5yvHV6vYd75gmAip NpRuItq4aPPT8dNQ/307HiIA3YESUi4= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736444364; a=rsa-sha256; cv=pass; b=tPihVMbeMgyi68U/l3nNTmY/p2dy6j4hWzrDBs5btyC8aQ5iTy0C0IqOFTjMbxPQjcNXDy wiqKYlIYjL8n2vIymxbv7NWskSyVkx7bTbdGfsrzyFSmSN6uldmRdFpZLsTDm+GjS5Yw+h YvWT1dvN0WiNtYgSG9oJERRNB5otigI= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=jZBwCQLG; dmarc=pass (policy=none) header.from=collabora.com; spf=pass (imf05.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1") 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> MIME-Version: 1.0 X-ZohoMailClient: External X-Stat-Signature: uxte1p7kqsje4iyjkawnw817fd559bk4 X-Rspamd-Queue-Id: 31E9F100010 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736444363-510524 X-HE-Meta: U2FsdGVkX1+RADAAPRI8WaJ1iw4wbMCvjPhI8JJICcHRT3f3kGABBBNl7EPQJODOpmlxaJiQgCmRr0TmPxxsHfAkPsGs8duw14dqfgrwvQml1eo5bukldRuDfRgBzvtTPYAF0wUnN95u0f8tshjcHfQcw4Mt/1jardJiGvSnuulnpK1I//I9o2+j0h7l3/cKca41AbmveDFYd1FnEqlgPu+0I96bMUxpPg1BTW5kt1q8S4I2+oPCmdsY6TprjYDAoL63a6vbXasKnJRyIX/g+6f8QFQux9Dr+1zRweWBci1Ozk9wQ/9oxRqLzXxWNw/2jesqf0geMaEqOvObuwpV+D0AZUKoA1tMRv2pextSRolUiMeCeaG9onwG5xqCNHIiltPy5cROPpbaXVZDjAs1HI36y44W1pLt23iGK70XJ1yaJDxbYcQnBLVYonrONUSgYJ0PPXk25+zqc5CipFceCgW9GyMn877qJyPJmpuOJgezdQVZVKrLAijuLCQ+D6BG7EIVrqZ+xm7gMQaS1HfCVXZwpCGchCl5kU9eEnvjMQVzBHhEj8/JVDcACZgmxSSpo6iq0a2pu+ltXFoZUcsHR3Z3nk9eHR10DnS4jRtYlWsxq49OD1g2tDzu0LTp91WkHHyGYq4pXe+eVp+iRLeF/Kmx1BPFcVzRqSQ44YkBruOVaQRULAQKRsr9WJ77Krxy7B3cCfsh/Rg1Gk9e1Feu3lCl+XBuiCFEJfhyYcdsgg4AmHO1YomRa32uhK8mCeEBD8U29pNhYBC7PVTPsK02F3ASRbcyDCmZRrvKTVxWFRfJIVpjyCE9AA8APOhX6LHoWILGNMneFbOOd+0IBG4TiBH5Il5XauXKXQUCTO+b4Sdwav6aGqjQiLh3o+WEFpERUASWFCYvys9HcNK0DGAmTM/394I6/ED2QDpCBkZvkG8K9w770TWZZEuB6deTiWcOEpqz8bkjtfkiJedqm5g MgXxpvct Uytmzi+7rqz+ekaynJzv5SAI/xTHiPeXNm95e1yej+R24RUIK0CifXhe3gQjGVRkTpItDx0TcXicddpNMnjMvQ5wQ0M7hB0i0GOwePdOb5sv3yP7rKgnRkLNuRdaIWgTYhcxCT89n6W2lO22j7UQ+gj4rlXCiZ0AerVHr6BxLVDwU80IA4C9I1WmZp0SswV66Yx1OjWTnYxhZ5RCzPKIo4IDIypxHH4Lhv+A31APOPtqPWL9j/NLh9rmlxKFRHuQSvjOlD4dw3Rgrv3ykuI5hEg3CNhSpP/a61+Lr4+XbaV+UMstZPnZcYk/S5UQPod2bIF1U 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: 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)