Date: Fri, 23 Jul 2010 18:58:27 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r210429 - in head/sys: amd64/linux32 compat/freebsd32 kern sys Message-ID: <201007231858.o6NIwRR3087236@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Fri Jul 23 18:58:27 2010 New Revision: 210429 URL: http://svn.freebsd.org/changeset/base/210429 Log: Eliminate a little bit of duplicated code. Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_exec.c head/sys/sys/imgact.h Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Fri Jul 23 17:53:39 2010 (r210428) +++ head/sys/amd64/linux32/linux32_machdep.c Fri Jul 23 18:58:27 2010 (r210429) @@ -200,9 +200,7 @@ linux_exec_copyin_args(struct image_args return (0); err_exit: - kmem_free_wakeup(exec_map, (vm_offset_t)args->buf, - PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); - args->buf = NULL; + exec_free_args(args); return (error); } Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Jul 23 17:53:39 2010 (r210428) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Jul 23 18:58:27 2010 (r210429) @@ -355,9 +355,7 @@ freebsd32_exec_copyin_args(struct image_ return (0); err_exit: - kmem_free_wakeup(exec_map, (vm_offset_t)args->buf, - PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); - args->buf = NULL; + exec_free_args(args); return (error); } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jul 23 17:53:39 2010 (r210428) +++ head/sys/kern/kern_exec.c Fri Jul 23 18:58:27 2010 (r210429) @@ -105,7 +105,6 @@ static int sysctl_kern_usrstack(SYSCTL_H static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); static int do_execve(struct thread *td, struct image_args *args, struct mac *mac_p); -static void exec_free_args(struct image_args *); /* XXX This should be vm_size_t. */ SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD, @@ -1155,11 +1154,11 @@ err_exit: return (error); } -static void +void exec_free_args(struct image_args *args) { - if (args->buf) { + if (args->buf != NULL) { kmem_free_wakeup(exec_map, (vm_offset_t)args->buf, PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); args->buf = NULL; Modified: head/sys/sys/imgact.h ============================================================================== --- head/sys/sys/imgact.h Fri Jul 23 17:53:39 2010 (r210428) +++ head/sys/sys/imgact.h Fri Jul 23 18:58:27 2010 (r210429) @@ -80,6 +80,7 @@ struct thread; int exec_check_permissions(struct image_params *); register_t *exec_copyout_strings(struct image_params *); +void exec_free_args(struct image_args *); int exec_new_vmspace(struct image_params *, struct sysentvec *); void exec_setregs(struct thread *, struct image_params *, u_long); int exec_shell_imgact(struct image_params *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007231858.o6NIwRR3087236>