Skip to content

Commit 8d68cab

Browse files
sunlimingkees
authored andcommitted
binfmt_elf_fdpic: fix variable set but not used warning
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 <[email protected]> Signed-off-by: sunliming <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent b0db1ed commit 8d68cab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/binfmt_elf_fdpic.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
10241024
/* deal with each load segment separately */
10251025
phdr = params->phdrs;
10261026
for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
1027-
unsigned long maddr, disp, excess, excess1;
1027+
unsigned long maddr, disp, excess;
10281028
int prot = 0, flags;
10291029

10301030
if (phdr->p_type != PT_LOAD)
@@ -1120,9 +1120,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
11201120
* extant in the file
11211121
*/
11221122
excess = phdr->p_memsz - phdr->p_filesz;
1123-
excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK);
11241123

11251124
#ifdef CONFIG_MMU
1125+
unsigned long excess1
1126+
= PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK);
11261127
if (excess > excess1) {
11271128
unsigned long xaddr = maddr + phdr->p_filesz + excess1;
11281129
unsigned long xmaddr;

0 commit comments

Comments
 (0)