From patchwork Thu Jan 9 17:38:39 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: 13933061 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 03178E7719A for ; Thu, 9 Jan 2025 17:40:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87B9A6B00A7; Thu, 9 Jan 2025 12:40:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DBD06B00A8; Thu, 9 Jan 2025 12:40:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 546DF6B00A9; Thu, 9 Jan 2025 12:40:10 -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 2D7096B00A7 for ; Thu, 9 Jan 2025 12:40:10 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C380F1A0302 for ; Thu, 9 Jan 2025 17:40:09 +0000 (UTC) X-FDA: 82988626938.06.B615B3A Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by imf30.hostedemail.com (Postfix) with ESMTP id CCC6A80014 for ; Thu, 9 Jan 2025 17:40:07 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=eHeKHjTz; arc=pass ("zohomail.com:s=zohoarc:i=1"); spf=pass (imf30.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=none) header.from=collabora.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736444408; 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=XUKQE+pYYQLtw6iu8h8iqPbRlit3OHNgXQDXtcizq18=; b=m6lTxhrwonoZRzMgPDbLWnRvHyaGxljyW18CzKGkUXbG8qOY6x92DGc49wynu+x8DByrzN 6srrLqra/y4nvKpd1rW9fyVjk5QitHOM4jqfTQKzIIw4mcSPek3EVdOVf0DMDGWjbkWBpJ IPx+jSzWgkb/tgv1oBJHPJrjghTmVGs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736444408; a=rsa-sha256; cv=pass; b=xLruyd9Qe5L7YWiYwvwoEsSGWa7Nq3mC+bEa+O3mbucKJEg20XEbWYY/QqrVRU3S2VDYZy JBi+TJbURB6I8Xcig6tBsRK8lWP9e50UhAbaRc0kmnZOjtdxAqBiTmluDaR2o8Qz0urTIU /z9YuBeP6I41Gw6cjBZ4bNfqskOLJuM= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=eHeKHjTz; arc=pass ("zohomail.com:s=zohoarc:i=1"); spf=pass (imf30.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=none) header.from=collabora.com ARC-Seal: i=1; a=rsa-sha256; t=1736444394; cv=none; d=zohomail.com; s=zohoarc; b=VlzaRCT5kdxtHLCSMGQmkERU8zSolIzcxLb8/I4WY1+XJLcLXFZ4OoS+D+w+FmDFfhqHjlzmE5kyPCEfHU1HynvZ8+F2D2ehyb136ZvgDVKATNwQfxgR7CKbbkJYbS0D4wbP9x6mLbirRPHfnwnToKvcafjOlDAhjCpTdg04bMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736444394; 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=XUKQE+pYYQLtw6iu8h8iqPbRlit3OHNgXQDXtcizq18=; b=Co8na6WkeEFbKrs/k0LxXEAsXWhT/Th5GrH/sf6RBEtz3CGBW3lVglsuVNNiREVa6Lg8ourjhRt28ySDAlUJwUe8idZI94sIzDHbRpZhJK7axrhmmyjn9mf5RiF6bb+rdwxIluD21rEw5Tgy3Ux8wMumM/1AhKT07YczssWzBvs= 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=1736444394; 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=XUKQE+pYYQLtw6iu8h8iqPbRlit3OHNgXQDXtcizq18=; b=eHeKHjTzhsqsZuOslb/hCZEQ5g7QV68DmaGZcMoRObOq17GCnwZNYwrGmqOmELLb TcSaH9qK60tCGL9SseD4ZKoMgREz+G/4Sm/rHWS1pk2vbTiUTWMPxl6VYELGfMHce9f D8xbR9TW8TIHh6mtvL8iM8LE9rGSIufzl5klIF6A= Received: by mx.zohomail.com with SMTPS id 1736444393092801.0156014908434; Thu, 9 Jan 2025 09:39:53 -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 13/16] selftests/mm: protection_keys: Fix variables types mismatch warnings Date: Thu, 9 Jan 2025 22:38:39 +0500 Message-Id: <20250109173842.1142376-14-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-Rspamd-Queue-Id: CCC6A80014 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: wnm13yo5fpoiniu69b6b7k1ot56btm4w X-HE-Tag: 1736444407-464050 X-HE-Meta: U2FsdGVkX18DTxaUKxwqiPNxvisI/BZY2seRlU+44YBnLWjTgt4BIIf2bGa+n5NUvJayq5CU1RuUB4VBGMtIV+Nwba/Shpy6+i8viwvfWhLyxDZN9lRTl8NnwWROIpINZkNwk5uqHQK9vexefqwzKp1FRtF9oEQY6gUpvPP4TnYNFT6v1lxO/LvG7Q2KW2q7esVYmTrFRveesYZK0zp7J7vF3KeAAC77pJOmz2bt/4znvUi/cCM4enQKIiIVDdQH7WRYv+OnJY0HJua2qLRUeO8FLvrK1SXydwYgbvvg3acDHDLHMLWzBg+6p/Qc40Djn9vF8VZ+0a8p9BS2KceO3r6YBApphySh/oHkxcZHbnO7ZwK2+vOJND3HUjTwK7caoiVr981MlJaQQKv6XCoAgPfEH2yuic30pMSunHzy/wcJ3Vp9RKBgAVhVlkDsFno/akAX8mXnJ0mw0z2StcxleaXoS1Yg+fUMgk8WiE4ZK0xWpDv/6bfhNp1TQnVHDhkTh0ar62OEvF2Q1TY1BaII2dICc1YE8JLwfC880H8uGV2r8NSKaNQxOUK0G9SOvIE2zFKr4pZBRyKCLOjqGNmYD8a1QI1sy44C31L3KM/qKMUsaRN/nwaRk2cKr703Mamu80rDOF7XTzx8oXCXBvsJ/q/mwc6PYnR/cTrh2UpXJo+W+ZSzQsFH/LB5O18ajR0U/p8QA+vJo2LyA4hvGOrfrponLKJeDmBPtTRjXIED6v3wtd8xqnKyjUczshymEpBb2K4uCPExYkpfBgduRWzs8De+VpbNhhbIFp+jQBwb/ZTE25euSdAStUp91pbTMTzHcUUU8z/Ico/YEhXRursWGWE0GW6mhXB/6ncBtC5AiYatFwETX+aocINbmbehouLxzRoi+SSfPoyMptHy4uxRkGfmZDa/ObDIL9Y+s/h5rvYIpRm7OygjsH2abjKCN6zNLHaM+OnbSaOHpzBl2NN 2E/JzHy5 0I73FLkRU4B/J6YkFSro1UvxVctqKFaCVb4BF4RieHz0gKh0eXNC7GcHlQRILkERna0RAHnJBLyCaCSJApTbpbqwiP/juzGHztKuH2N6kYxPB70dFh5UBdGx4ksWvDieKTYzqoAhQ3a61vtcAieWCYJ15vZPbhmg8dWrHSVMI6lN1BmbkSiQp4coOu54AO2vSU2B+txeOm+jjRu9Jln73ZarDPsnUFzJ/LC9Io2aPhk2SFeDsgZ6MBLQoScGntqPZ8DrR8gW8DZK4tLymvTUDARL3ks9VCvo2/FjQ69X8OuPBV4ESBB5dlbHQ+SNeQ0EMSGbv0ly51CXzGRP4fzjBhuUjDmSeqx0oyB/5GXP5DS2OWeksz3VZ7dF9ag== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000133, 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 variable type mismatch warnings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/protection_keys.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c index 3a66798a8e8d6..ab1e586bc2728 100644 --- a/tools/testing/selftests/mm/protection_keys.c +++ b/tools/testing/selftests/mm/protection_keys.c @@ -78,7 +78,7 @@ static void cat_into_file(char *str, char *file) } ret = write(fd, str, strlen(str)); - if (ret != strlen(str)) { + if (ret != (signed int)strlen(str)) { perror("write to file failed"); fprintf(stderr, "filename: '%s' str: '%s'\n", file, str); exit(__LINE__); @@ -597,10 +597,10 @@ struct pkey_malloc_record *pkey_last_malloc_record; static long nr_pkey_malloc_records; void record_pkey_malloc(void *ptr, long size, int prot) { - long i; + unsigned long i; struct pkey_malloc_record *rec = NULL; - for (i = 0; i < nr_pkey_malloc_records; i++) { + for (i = 0; i < (unsigned long)nr_pkey_malloc_records; i++) { rec = &pkey_malloc_records[i]; /* find a free record */ if (rec) @@ -866,7 +866,7 @@ static int nr_test_fds; static void __save_test_fd(int fd) { pkey_assert(fd >= 0); - pkey_assert(nr_test_fds < ARRAY_SIZE(test_fds)); + pkey_assert(nr_test_fds < (signed int)ARRAY_SIZE(test_fds)); test_fds[nr_test_fds] = fd; nr_test_fds++; } @@ -897,7 +897,7 @@ static void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 __attribute__((unuse int max_nr_pkey_allocs; int alloced_pkeys[NR_PKEYS]; int nr_alloced = 0; - long size; + unsigned long size; pkey_assert(pkey_last_malloc_record); size = pkey_last_malloc_record->size; @@ -1280,7 +1280,7 @@ static void test_pkey_init_state(int __attribute__((unused)) *ptr, u16 __attribu */ static void test_mprotect_with_pkey_0(int *ptr, u16 pkey) { - long size; + unsigned long size; int prot; assert(pkey_last_malloc_record); @@ -1530,7 +1530,7 @@ static void test_ptrace_modifies_pkru(int __attribute__((unused)) *ptr, pkey_assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP); xsave = (void *)malloc(xsave_size); - pkey_assert(xsave > 0); + pkey_assert(xsave != NULL); /* Modify the PKRU register directly */ iov.iov_base = xsave; @@ -1727,7 +1727,7 @@ static void run_tests_once(void) int *ptr; int prot = PROT_READ|PROT_WRITE; - for (test_nr = 0; test_nr < ARRAY_SIZE(pkey_tests); test_nr++) { + for (test_nr = 0; test_nr < (signed int)ARRAY_SIZE(pkey_tests); test_nr++) { int pkey; int orig_pkey_faults = pkey_faults;