Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

binfmt_elf: cleanups

This cleans up a few bits in binfmt_elf.c and binfmts.h:

- the hasvdso field in struct linux_binfmt is unused, so remove it and
the only initialization of it

- the elf_map CPP symbol is not defined anywhere in the kernel, so
remove an unnecessary #ifndef elf_map

- reduce excessive indentation in elf_format's initializer

- add missing spaces, remove extraneous spaces

No functional changes, but tested on x86 (32 and 64 bit), powerpc (32 and
64 bit), sparc64, arm, and alpha.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mikael Pettersson and committed by
Linus Torvalds
f670d0ec 52bd19f7

+11 -17
+9 -14
fs/binfmt_elf.c
··· 66 66 #define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1)) 67 67 68 68 static struct linux_binfmt elf_format = { 69 - .module = THIS_MODULE, 70 - .load_binary = load_elf_binary, 71 - .load_shlib = load_elf_library, 72 - .core_dump = elf_core_dump, 73 - .min_coredump = ELF_EXEC_PAGESIZE, 74 - .hasvdso = 1 69 + .module = THIS_MODULE, 70 + .load_binary = load_elf_binary, 71 + .load_shlib = load_elf_library, 72 + .core_dump = elf_core_dump, 73 + .min_coredump = ELF_EXEC_PAGESIZE, 75 74 }; 76 75 77 76 #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) ··· 315 316 return 0; 316 317 } 317 318 318 - #ifndef elf_map 319 - 320 319 static unsigned long elf_map(struct file *filep, unsigned long addr, 321 320 struct elf_phdr *eppnt, int prot, int type, 322 321 unsigned long total_size) ··· 350 353 up_write(&current->mm->mmap_sem); 351 354 return(map_addr); 352 355 } 353 - 354 - #endif /* !elf_map */ 355 356 356 357 static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr) 357 358 { ··· 416 421 goto out; 417 422 418 423 retval = kernel_read(interpreter, interp_elf_ex->e_phoff, 419 - (char *)elf_phdata,size); 424 + (char *)elf_phdata, size); 420 425 error = -EIO; 421 426 if (retval != size) { 422 427 if (retval < 0) ··· 596 601 goto out; 597 602 if (!elf_check_arch(&loc->elf_ex)) 598 603 goto out; 599 - if (!bprm->file->f_op||!bprm->file->f_op->mmap) 604 + if (!bprm->file->f_op || !bprm->file->f_op->mmap) 600 605 goto out; 601 606 602 607 /* Now read in all of the header information */ ··· 756 761 /* There was a PT_LOAD segment with p_memsz > p_filesz 757 762 before this one. Map anonymous pages, if needed, 758 763 and clear the area. */ 759 - retval = set_brk (elf_bss + load_bias, 760 - elf_brk + load_bias); 764 + retval = set_brk(elf_bss + load_bias, 765 + elf_brk + load_bias); 761 766 if (retval) { 762 767 send_sig(SIGKILL, current, 0); 763 768 goto out_free_dentry;
+2 -3
include/linux/binfmts.h
··· 25 25 /* 26 26 * This structure is used to hold the arguments that are used when loading binaries. 27 27 */ 28 - struct linux_binprm{ 28 + struct linux_binprm { 29 29 char buf[BINPRM_BUF_SIZE]; 30 30 #ifdef CONFIG_MMU 31 31 struct vm_area_struct *vma; ··· 93 93 int (*load_shlib)(struct file *); 94 94 int (*core_dump)(struct coredump_params *cprm); 95 95 unsigned long min_coredump; /* minimal dump size */ 96 - int hasvdso; 97 96 }; 98 97 99 98 extern int __register_binfmt(struct linux_binfmt *fmt, int insert); ··· 112 113 113 114 extern int prepare_binprm(struct linux_binprm *); 114 115 extern int __must_check remove_arg_zero(struct linux_binprm *); 115 - extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 116 + extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); 116 117 extern int flush_old_exec(struct linux_binprm * bprm); 117 118 extern void setup_new_exec(struct linux_binprm * bprm); 118 119