Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2018 23:16:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340862 - head/sys/kern
Message-ID:  <201811232316.wANNG2nK037677@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Nov 23 23:16:01 2018
New Revision: 340862
URL: https://svnweb.freebsd.org/changeset/base/340862

Log:
  Trivial reduction of the code duplication, reuse the return FALSE code.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Fri Nov 23 23:10:03 2018	(r340861)
+++ head/sys/kern/imgact_elf.c	Fri Nov 23 23:16:01 2018	(r340862)
@@ -2364,8 +2364,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra
 		    curthread->td_ucred, NOCRED, NULL, curthread);
 		if (error != 0) {
 			uprintf("i/o error PT_NOTE\n");
-			res = FALSE;
-			goto ret;
+			goto retf;
 		}
 		note = note0 = (const Elf_Note *)buf;
 		note_end = (const Elf_Note *)(buf + pnote->p_filesz);
@@ -2379,8 +2378,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra
 	for (i = 0; i < 100 && note >= note0 && note < note_end; i++) {
 		if (!aligned(note, Elf32_Addr) || (const char *)note_end -
 		    (const char *)note < sizeof(Elf_Note)) {
-			res = FALSE;
-			goto ret;
+			goto retf;
 		}
 		if (note->n_namesz != checknote->hdr.n_namesz ||
 		    note->n_descsz != checknote->hdr.n_descsz ||
@@ -2408,6 +2406,7 @@ nextnote:
 		    roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) +
 		    roundup2(note->n_descsz, ELF_NOTE_ROUNDSIZE));
 	}
+retf:
 	res = FALSE;
 ret:
 	free(buf, M_TEMP);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811232316.wANNG2nK037677>