lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202501090941.5289E7444B@keescook>
Date: Thu, 9 Jan 2025 09:42:12 -0800
From: Kees Cook <kees@...nel.org>
To: Muhammad Usama Anjum <usama.anjum@...labora.com>
Cc: Andy Lutomirski <luto@...capital.net>, Will Drewry <wad@...omium.org>,
	Shuah Khan <shuah@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jérôme Glisse <jglisse@...hat.com>,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, kernel@...labora.com
Subject: Re: [PATCH 01/16] selftests/mm: remove argc and argv unused
 parameters

On Thu, Jan 09, 2025 at 10:38:27PM +0500, Muhammad Usama Anjum wrote:
> 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 <usama.anjum@...labora.com>
> ---
>  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)

Can we add a macro in kselftest.h for "__unused" like the kernel already
does? Then instead of removing args, we can just mark them, like you're
doing here.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ