Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Sep 2014 23:59:20 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272290 - head/sys/kern
Message-ID:  <201409292359.s8TNxK1j020426@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Mon Sep 29 23:59:19 2014
New Revision: 272290
URL: http://svnweb.freebsd.org/changeset/base/272290

Log:
  Use bzero instead of explicitly zeroing stuff in do_execve.
  
  While strictly speaking this is not correct since some fields are pointers,
  it makes no difference on all supported archs and we already rely on it doing
  the right thing in other places.
  
  No functional changes.

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Mon Sep 29 21:54:46 2014	(r272289)
+++ head/sys/kern/kern_exec.c	Mon Sep 29 23:59:19 2014	(r272290)
@@ -379,29 +379,10 @@ do_execve(td, args, mac_p)
 	/*
 	 * Initialize part of the common data
 	 */
+	bzero(imgp, sizeof(*imgp));
 	imgp->proc = p;
-	imgp->execlabel = NULL;
 	imgp->attr = &attr;
-	imgp->entry_addr = 0;
-	imgp->reloc_base = 0;
-	imgp->vmspace_destroyed = 0;
-	imgp->interpreted = 0;
-	imgp->opened = 0;
-	imgp->interpreter_name = NULL;
-	imgp->auxargs = NULL;
-	imgp->vp = NULL;
-	imgp->object = NULL;
-	imgp->firstpage = NULL;
-	imgp->ps_strings = 0;
-	imgp->auxarg_size = 0;
 	imgp->args = args;
-	imgp->execpath = imgp->freepath = NULL;
-	imgp->execpathp = 0;
-	imgp->canary = 0;
-	imgp->canarylen = 0;
-	imgp->pagesizes = 0;
-	imgp->pagesizeslen = 0;
-	imgp->stack_prot = 0;
 
 #ifdef MAC
 	error = mac_execve_enter(imgp, mac_p);
@@ -409,8 +390,6 @@ do_execve(td, args, mac_p)
 		goto exec_fail;
 #endif
 
-	imgp->image_header = NULL;
-
 	/*
 	 * Translate the file name. namei() returns a vnode pointer
 	 *	in ni_vp amoung other things.



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