Skip to contentSkip to conversation

binfmt_elf: simplify error handling in load_elf_phdrs()

PATCH New Rolf Eike Beer 1 participant 1 message Nov 4, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 binfmt_elf: simplify error handling in load_elf_phdrs()

---
 fs/binfmt_elf.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
fs/binfmt_elf.c +2 -8
index b588d1291b25..74827a7a06d0 100644
@@ -458,7 +458,7 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex,
 				       struct file *elf_file)
 {
 	struct elf_phdr *elf_phdata = NULL;
-	int retval, err = -1;
+	int retval = -1;
 	unsigned int size;
 
 	/*
@@ -480,15 +480,9 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex,
 
 	/* Read in the program headers */
 	retval = elf_read(elf_file, elf_phdata, size, elf_ex->e_phoff);
-	if (retval < 0) {
-		err = retval;
-		goto out;
-	}
 
-	/* Success! */
-	err = 0;
 out:
-	if (err) {
+	if (retval) {
 		kfree(elf_phdata);
 		elf_phdata = NULL;
 	}
Signature · 11 lines
2.29.1


-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source