svn commit: r312725 - head/sys/kern

Ed Maste emaste at FreeBSD.org
Tue Jan 24 22:46:44 UTC 2017


Author: emaste
Date: Tue Jan 24 22:46:43 2017
New Revision: 312725
URL: https://svnweb.freebsd.org/changeset/base/312725

Log:
  imgact_elf: refactor et_dyn_addr calculation
  
  This simplifies the logic somewhat. It is extracted from the change in
  review in D5603.
  
  Differential Revision:	https://reviews.freebsd.org/D9321

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Tue Jan 24 22:00:16 2017	(r312724)
+++ head/sys/kern/imgact_elf.c	Tue Jan 24 22:46:43 2017	(r312725)
@@ -859,6 +859,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i
 		error = ENOEXEC;
 		goto ret;
 	}
+	et_dyn_addr = 0;
 	if (hdr->e_type == ET_DYN) {
 		if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) {
 			uprintf("Cannot execute shared object\n");
@@ -871,10 +872,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i
 		 */
 		if (baddr == 0)
 			et_dyn_addr = ET_DYN_LOAD_ADDR;
-		else
-			et_dyn_addr = 0;
-	} else
-		et_dyn_addr = 0;
+	}
 	sv = brand_info->sysvec;
 	if (interp != NULL && brand_info->interp_newpath != NULL)
 		newinterp = brand_info->interp_newpath;
@@ -1058,7 +1056,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i
 	imgp->reloc_base = addr;
 	imgp->proc->p_osrel = osrel;
 
- ret:
+ret:
 	free(interp_buf, M_TEMP);
 	return (error);
 }


More information about the svn-src-head mailing list