Remove unneeded pointer `ndp'.
Inside do_execve(), we have a pointer `ndp', which always points to `&nd'. I can imagine a primitive (non-optimizing) compiler to really reserve space for such a pointer, so just remove the variable and use `&nd' directly.
This commit is contained in:
parent
c90c9021e9
commit
69c9eff894
@ -318,7 +318,7 @@ do_execve(td, args, mac_p)
|
|||||||
struct mac *mac_p;
|
struct mac *mac_p;
|
||||||
{
|
{
|
||||||
struct proc *p = td->td_proc;
|
struct proc *p = td->td_proc;
|
||||||
struct nameidata nd, *ndp;
|
struct nameidata nd;
|
||||||
struct ucred *newcred = NULL, *oldcred;
|
struct ucred *newcred = NULL, *oldcred;
|
||||||
struct uidinfo *euip;
|
struct uidinfo *euip;
|
||||||
register_t *stack_base;
|
register_t *stack_base;
|
||||||
@ -396,8 +396,7 @@ do_execve(td, args, mac_p)
|
|||||||
* interpreter if this is an interpreted binary.
|
* interpreter if this is an interpreted binary.
|
||||||
*/
|
*/
|
||||||
if (args->fname != NULL) {
|
if (args->fname != NULL) {
|
||||||
ndp = &nd;
|
NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME
|
||||||
NDINIT(ndp, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME
|
|
||||||
| MPSAFE | AUDITVNODE1, UIO_SYSSPACE, args->fname, td);
|
| MPSAFE | AUDITVNODE1, UIO_SYSSPACE, args->fname, td);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,12 +404,12 @@ do_execve(td, args, mac_p)
|
|||||||
|
|
||||||
interpret:
|
interpret:
|
||||||
if (args->fname != NULL) {
|
if (args->fname != NULL) {
|
||||||
error = namei(ndp);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto exec_fail;
|
goto exec_fail;
|
||||||
|
|
||||||
vfslocked = NDHASGIANT(ndp);
|
vfslocked = NDHASGIANT(&nd);
|
||||||
binvp = ndp->ni_vp;
|
binvp = nd.ni_vp;
|
||||||
imgp->vp = binvp;
|
imgp->vp = binvp;
|
||||||
} else {
|
} else {
|
||||||
AUDIT_ARG(fd, args->fd);
|
AUDIT_ARG(fd, args->fd);
|
||||||
@ -495,7 +494,7 @@ interpret:
|
|||||||
imgp->vp->v_vflag &= ~VV_TEXT;
|
imgp->vp->v_vflag &= ~VV_TEXT;
|
||||||
/* free name buffer and old vnode */
|
/* free name buffer and old vnode */
|
||||||
if (args->fname != NULL)
|
if (args->fname != NULL)
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
mac_execve_interpreter_enter(binvp, &interpvplabel);
|
mac_execve_interpreter_enter(binvp, &interpvplabel);
|
||||||
#endif
|
#endif
|
||||||
@ -509,7 +508,7 @@ interpret:
|
|||||||
VFS_UNLOCK_GIANT(vfslocked);
|
VFS_UNLOCK_GIANT(vfslocked);
|
||||||
vfslocked = 0;
|
vfslocked = 0;
|
||||||
/* set new name to that of the interpreter */
|
/* set new name to that of the interpreter */
|
||||||
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME | MPSAFE,
|
NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME | MPSAFE,
|
||||||
UIO_SYSSPACE, imgp->interpreter_name, td);
|
UIO_SYSSPACE, imgp->interpreter_name, td);
|
||||||
args->fname = imgp->interpreter_name;
|
args->fname = imgp->interpreter_name;
|
||||||
goto interpret;
|
goto interpret;
|
||||||
@ -588,8 +587,8 @@ interpret:
|
|||||||
|
|
||||||
/* name this process - nameiexec(p, ndp) */
|
/* name this process - nameiexec(p, ndp) */
|
||||||
if (args->fname) {
|
if (args->fname) {
|
||||||
len = min(ndp->ni_cnd.cn_namelen,MAXCOMLEN);
|
len = min(nd.ni_cnd.cn_namelen,MAXCOMLEN);
|
||||||
bcopy(ndp->ni_cnd.cn_nameptr, p->p_comm, len);
|
bcopy(nd.ni_cnd.cn_nameptr, p->p_comm, len);
|
||||||
} else {
|
} else {
|
||||||
if (vn_commname(binvp, p->p_comm, MAXCOMLEN + 1) == 0)
|
if (vn_commname(binvp, p->p_comm, MAXCOMLEN + 1) == 0)
|
||||||
len = MAXCOMLEN;
|
len = MAXCOMLEN;
|
||||||
@ -851,7 +850,7 @@ exec_fail_dealloc:
|
|||||||
|
|
||||||
if (imgp->vp != NULL) {
|
if (imgp->vp != NULL) {
|
||||||
if (args->fname)
|
if (args->fname)
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
if (imgp->opened)
|
if (imgp->opened)
|
||||||
VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td);
|
VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td);
|
||||||
vput(imgp->vp);
|
vput(imgp->vp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user