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: <a555rynwidxdyj7s3oswpmcnkqu57jv3wsk5qwfg5zz6m55na3@n53ssiekfch4>
Date: Fri, 7 Mar 2025 15:47:28 +0100
From: Jan Kara <jack@...e.cz>
To: sunliming@...ux.dev
Cc: viro@...iv.linux.org.uk, brauner@...nel.org, jack@...e.cz, 
	kees@...nel.org, ebiederm@...ssion.com, linux-fsdevel@...r.kernel.org, 
	linux-mm@...ck.org, linux-kernel@...r.kernel.org, sunliming@...inos.cn, 
	kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] fs: binfmt_elf_efpic: fix variable set but not used
 warning

On Fri 07-03-25 14:11:28, sunliming@...ux.dev wrote:
> From: sunliming <sunliming@...inos.cn>
> 
> Fix below kernel warning:
> fs/binfmt_elf_fdpic.c:1024:52: warning: variable 'excess1' set but not
> used [-Wunused-but-set-variable]
> 
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: sunliming <sunliming@...inos.cn>

The extra ifdef is not pretty but I guess it's better. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/binfmt_elf_fdpic.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index e3cf2801cd64..bed13ee8bfec 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -1024,8 +1024,11 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
>  	/* deal with each load segment separately */
>  	phdr = params->phdrs;
>  	for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
> -		unsigned long maddr, disp, excess, excess1;
> +		unsigned long maddr, disp, excess;
>  		int prot = 0, flags;
> +#ifdef CONFIG_MMU
> +		unsigned long excess1;
> +#endif
>  
>  		if (phdr->p_type != PT_LOAD)
>  			continue;
> @@ -1120,9 +1123,9 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
>  		 *   extant in the file
>  		 */
>  		excess = phdr->p_memsz - phdr->p_filesz;
> -		excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK);
>  
>  #ifdef CONFIG_MMU
> +		excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK);
>  		if (excess > excess1) {
>  			unsigned long xaddr = maddr + phdr->p_filesz + excess1;
>  			unsigned long xmaddr;
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ