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]
Date: Tue, 25 Jun 2024 11:05:26 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Abhinav Jain <jain.abhinav177@...il.com>
Cc: shuah@...nel.org, linux-kernel@...r.kernel.org,
 linux-fsdevel@...r.kernel.org, linux-kselftest@...r.kernel.org,
 skhan@...uxfoundation.org, javier.carrasco.cruz@...il.com
Subject: Re: [PATCH] selftests/proc: fix unused result warning during test
 compilation

On Tue, 25 Jun 2024 15:21:39 +0000 Abhinav Jain <jain.abhinav177@...il.com> wrote:

> Check the return value from write function to get rid of the warning
> during test compilation, shared below.
> Tested by compiling after the change, the warning disappears.
> 
> proc-empty-vm.c:385:17: warning: ignoring return value of ‘write’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
>   385 |                 write(1, buf, rv);
> 
> ...
>
> --- a/tools/testing/selftests/proc/proc-empty-vm.c
> +++ b/tools/testing/selftests/proc/proc-empty-vm.c
> @@ -382,7 +382,12 @@ static int test_proc_pid_statm(pid_t pid)
>  	assert(rv >= 0);
>  	assert(rv <= sizeof(buf));
>  	if (0) {
> -		write(1, buf, rv);
> +		ssize_t bytes_written = write(1, buf, rv);
> +
> +		if (bytes_written != rv) {
> +			perror("write");
> +			return EXIT_FAILURE;
> +		}
>  	}

Thanks.  There's a patch queued which simply deletes this code.

https://lkml.kernel.org/r/20240603124220.33778-1-amer.shanawany@gmail.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ