Commit f670d0ecda73b7438eec9ed108680bc5f5362ad8

Authored by Mikael Pettersson
Committed by Linus Torvalds
1 parent 52bd19f769

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>

Showing 2 changed files with 11 additions and 17 deletions Side-by-side Diff

... ... @@ -66,12 +66,11 @@
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)
... ... @@ -316,8 +315,6 @@
316 315 return 0;
317 316 }
318 317  
319   -#ifndef elf_map
320   -
321 318 static unsigned long elf_map(struct file *filep, unsigned long addr,
322 319 struct elf_phdr *eppnt, int prot, int type,
323 320 unsigned long total_size)
... ... @@ -354,8 +351,6 @@
354 351 return(map_addr);
355 352 }
356 353  
357   -#endif /* !elf_map */
358   -
359 354 static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
360 355 {
361 356 int i, first_idx = -1, last_idx = -1;
... ... @@ -421,7 +416,7 @@
421 416 goto out;
422 417  
423 418 retval = kernel_read(interpreter, interp_elf_ex->e_phoff,
424   - (char *)elf_phdata,size);
  419 + (char *)elf_phdata, size);
425 420 error = -EIO;
426 421 if (retval != size) {
427 422 if (retval < 0)
... ... @@ -601,7 +596,7 @@
601 596 goto out;
602 597 if (!elf_check_arch(&loc->elf_ex))
603 598 goto out;
604   - if (!bprm->file->f_op||!bprm->file->f_op->mmap)
  599 + if (!bprm->file->f_op || !bprm->file->f_op->mmap)
605 600 goto out;
606 601  
607 602 /* Now read in all of the header information */
... ... @@ -761,8 +756,8 @@
761 756 /* There was a PT_LOAD segment with p_memsz > p_filesz
762 757 before this one. Map anonymous pages, if needed,
763 758 and clear the area. */
764   - retval = set_brk (elf_bss + load_bias,
765   - elf_brk + load_bias);
  759 + retval = set_brk(elf_bss + load_bias,
  760 + elf_brk + load_bias);
766 761 if (retval) {
767 762 send_sig(SIGKILL, current, 0);
768 763 goto out_free_dentry;
include/linux/binfmts.h
... ... @@ -25,7 +25,7 @@
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,7 +93,6 @@
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);
... ... @@ -113,7 +112,7 @@
113 112  
114 113 extern int prepare_binprm(struct linux_binprm *);
115 114 extern int __must_check remove_arg_zero(struct linux_binprm *);
116   -extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
  115 +extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
117 116 extern int flush_old_exec(struct linux_binprm * bprm);
118 117 extern void setup_new_exec(struct linux_binprm * bprm);
119 118