Commit be0deb58 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

fs/binfmt_elf.c: save 1 indent level

Rewrite

	for (...) {
		if (->p_type == PT_INTERP) {
			...
			break;
		}
	}

loop into

	for (...) {
		if (->p_type != PT_INTERP)
			continue;
		...
		break;
	}

Link: http://lkml.kernel.org/r/20190416201906.GA24304@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ba0f6b88
...@@ -740,23 +740,23 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -740,23 +740,23 @@ static int load_elf_binary(struct linux_binprm *bprm)
start_data = 0; start_data = 0;
end_data = 0; end_data = 0;
for (i = 0; i < loc->elf_ex.e_phnum; i++) { for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
if (elf_ppnt->p_type == PT_INTERP) {
char *elf_interpreter; char *elf_interpreter;
loff_t pos; loff_t pos;
/* This is the program interpreter used for if (elf_ppnt->p_type != PT_INTERP)
* shared libraries - for now assume that this continue;
* is an a.out format binary
/*
* This is the program interpreter used for shared libraries -
* for now assume that this is an a.out format binary.
*/ */
retval = -ENOEXEC; retval = -ENOEXEC;
if (elf_ppnt->p_filesz > PATH_MAX || if (elf_ppnt->p_filesz > PATH_MAX || elf_ppnt->p_filesz < 2)
elf_ppnt->p_filesz < 2)
goto out_free_ph; goto out_free_ph;
retval = -ENOMEM; retval = -ENOMEM;
elf_interpreter = kmalloc(elf_ppnt->p_filesz, elf_interpreter = kmalloc(elf_ppnt->p_filesz, GFP_KERNEL);
GFP_KERNEL);
if (!elf_interpreter) if (!elf_interpreter)
goto out_free_ph; goto out_free_ph;
...@@ -780,9 +780,8 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -780,9 +780,8 @@ static int load_elf_binary(struct linux_binprm *bprm)
goto out_free_ph; goto out_free_ph;
/* /*
* If the binary is not readable then enforce * If the binary is not readable then enforce mm->dumpable = 0
* mm->dumpable = 0 regardless of the interpreter's * regardless of the interpreter's permissions.
* permissions.
*/ */
would_dump(bprm, interpreter); would_dump(bprm, interpreter);
...@@ -802,8 +801,6 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -802,8 +801,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
kfree(elf_interpreter); kfree(elf_interpreter);
goto out_free_ph; goto out_free_ph;
} }
elf_ppnt++;
}
elf_ppnt = elf_phdata; elf_ppnt = elf_phdata;
for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment