Skip to content

Commit 36650a3

Browse files
tititiou36kees
authored andcommitted
binfmt: Slightly simplify elf_fdpic_map_file()
There is no point in initializing 'load_addr' and 'seg' here, they are both re-written just before being used below. Doing so, 'load_addr' can be moved in the #ifdef CONFIG_MMU section. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/4f5e4096ad7f17716e924b5bd080e5709fc0b84b.1685290790.git.christophe.jaillet@wanadoo.fr
1 parent e6302d5 commit 36650a3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

fs/binfmt_elf_fdpic.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,11 +743,12 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
743743
struct elf32_fdpic_loadmap *loadmap;
744744
#ifdef CONFIG_MMU
745745
struct elf32_fdpic_loadseg *mseg;
746+
unsigned long load_addr;
746747
#endif
747748
struct elf32_fdpic_loadseg *seg;
748749
struct elf32_phdr *phdr;
749-
unsigned long load_addr, stop;
750750
unsigned nloads, tmp;
751+
unsigned long stop;
751752
int loop, ret;
752753

753754
/* allocate a load map table */
@@ -768,9 +769,6 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
768769
loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
769770
loadmap->nsegs = nloads;
770771

771-
load_addr = params->load_addr;
772-
seg = loadmap->segs;
773-
774772
/* map the requested LOADs into the memory space */
775773
switch (params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) {
776774
case ELF_FDPIC_FLAG_CONSTDISP:

0 commit comments

Comments
 (0)