+ selftests-mm-protection_keys-fix-variables-types-mismatch-warnings.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: selftests/mm: protection_keys: fix variables types mismatch warnings
has been added to the -mm mm-unstable branch.  Its filename is
     selftests-mm-protection_keys-fix-variables-types-mismatch-warnings.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-protection_keys-fix-variables-types-mismatch-warnings.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
Subject: selftests/mm: protection_keys: fix variables types mismatch warnings
Date: Thu, 9 Jan 2025 22:38:39 +0500

Fix variable type mismatch warnings.

Link: https://lkml.kernel.org/r/20250109173842.1142376-14-usama.anjum@xxxxxxxxxxxxx
Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
Cc: Jérôme Glisse <jglisse@xxxxxxxxxx>
Cc: Kees Cook <kees@xxxxxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Cc: Will Drewry <wad@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 tools/testing/selftests/mm/protection_keys.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--- a/tools/testing/selftests/mm/protection_keys.c~selftests-mm-protection_keys-fix-variables-types-mismatch-warnings
+++ a/tools/testing/selftests/mm/protection_keys.c
@@ -78,7 +78,7 @@ static void cat_into_file(char *str, cha
 	}
 
 	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_mal
 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_
 	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 *pt
  */
 static void test_mprotect_with_pkey_0(int *ptr, u16 pkey)
 {
-	long size;
+	unsigned long size;
 	int prot;
 
 	assert(pkey_last_malloc_record);
@@ -1528,7 +1528,7 @@ static void test_ptrace_modifies_pkru(in
 	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;
@@ -1725,7 +1725,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;
 
_

Patches currently in -mm which might be from usama.anjum@xxxxxxxxxxxxx are

selftests-mm-thp_settings-remove-const-from-return-type.patch
selftests-mm-pagemap_ioctl-fix-types-mismatches-shown-by-compiler-options.patch
selftests-mm-mseal_test-remove-unused-variables.patch
selftests-mm-mremap_test-remove-unused-variable-and-type-mismatches.patch
selftests-mm-remove-argc-and-argv-unused-parameters.patch
selftests-mm-fix-unused-parameter-warnings.patch
selftests-mm-fix-type-mismatch-warnings.patch
selftests-mm-kselftest_harness-fix-warnings.patch
selftests-mm-cow-remove-unused-variables-and-fix-type-mismatch-errors.patch
selftests-mm-hmm-tests-remove-always-false-expressions.patch
selftests-mm-guard-pages-fix-type-mismatch-warnings.patch
selftests-mm-hugetlb-madvise-fix-type-mismatch-issues.patch
selftests-mm-hugepage-vmemmap-fix-type-mismatch-warnings.patch
selftests-mm-hugetlb-read-hwpoison-fix-type-mismatch-warnings.patch
selftests-mm-khugepaged-fix-type-mismatch-warnings.patch
selftests-mm-protection_keys-fix-variables-types-mismatch-warnings.patch
selftests-mm-thuge-gen-fix-type-mismatch-warnings.patch
selftests-mm-uffd-fix-all-type-mismatch-warnings.patch
selftests-mm-makefile-add-the-compiler-flags.patch





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux