From owner-svn-src-all@freebsd.org Thu Jul 2 19:14:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 318DA99339C; Thu, 2 Jul 2015 19:14:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1781D199A; Thu, 2 Jul 2015 19:14:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t62JEU3Q037069; Thu, 2 Jul 2015 19:14:30 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t62JEUro037068; Thu, 2 Jul 2015 19:14:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201507021914.t62JEUro037068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 2 Jul 2015 19:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285057 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2015 19:14:31 -0000 Author: mjg Date: Thu Jul 2 19:14:30 2015 New Revision: 285057 URL: https://svnweb.freebsd.org/changeset/base/285057 Log: sysvshm: fix up some whitespace issues and spurious initialisation Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Jul 2 19:03:44 2015 (r285056) +++ head/sys/kern/sysv_shm.c Thu Jul 2 19:14:30 2015 (r285057) @@ -216,7 +216,7 @@ shm_find_segment(int arg, bool is_shmid) shmseg = &shmsegs[segnum]; if ((shmseg->u.shm_perm.mode & SHMSEG_ALLOCATED) == 0 || (!shm_allow_removed && - (shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) || + (shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) || (is_shmid && shmseg->u.shm_perm.seq != IPCID_TO_SEQ(arg))) return (NULL); return (shmseg); @@ -278,8 +278,9 @@ kern_shmdt_locked(struct thread *td, con struct shmmap_state *shmmap_s; #ifdef MAC struct shmid_kernel *shmsegptr; + int error; #endif - int error, i; + int i; SYSVSHM_ASSERT_LOCKED(); if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) @@ -301,8 +302,7 @@ kern_shmdt_locked(struct thread *td, con if (error != 0) return (error); #endif - error = shm_delete_mapping(p->p_vmspace, shmmap_s); - return (error); + return (shm_delete_mapping(p->p_vmspace, shmmap_s)); } #ifndef _SYS_SYSPROTO_H_ @@ -441,7 +441,6 @@ kern_shmctl_locked(struct thread *td, in if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) return (ENOSYS); - error = 0; switch (cmd) { /* * It is possible that kern_shmctl is being called from the Linux ABI @@ -550,10 +549,10 @@ struct shmctl_args { int sys_shmctl(struct thread *td, struct shmctl_args *uap) { - int error = 0; + int error; struct shmid_ds buf; size_t bufsz; - + /* * The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support * Linux binaries. If we see the call come through the FreeBSD ABI, @@ -568,11 +567,11 @@ sys_shmctl(struct thread *td, struct shm if ((error = copyin(uap->buf, &buf, sizeof(struct shmid_ds)))) goto done; } - + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz); if (error) goto done; - + /* Cases in which we need to copyout */ switch (uap->cmd) { case IPC_STAT: @@ -894,7 +893,7 @@ shminit(void) static int shmunload(void) { - int i; + int i; if (shm_nused > 0) return (EBUSY); @@ -995,8 +994,7 @@ oshmctl(struct thread *td, struct oshmct outbuf.shm_ctime = shmseg->u.shm_ctime; outbuf.shm_handle = shmseg->object; SYSVSHM_UNLOCK(); - error = copyout(&outbuf, uap->ubuf, sizeof(outbuf)); - return (error); + return (copyout(&outbuf, uap->ubuf, sizeof(outbuf))); #else return (EINVAL); #endif @@ -1021,14 +1019,12 @@ struct shmsys_args { int sys_shmsys(struct thread *td, struct shmsys_args *uap) { - int error; if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) return (ENOSYS); if (uap->which < 0 || uap->which >= nitems(shmcalls)) return (EINVAL); - error = (*shmcalls[uap->which])(td, &uap->a2); - return (error); + return ((*shmcalls[uap->which])(td, &uap->a2)); } #endif /* i386 && (COMPAT_FREEBSD4 || COMPAT_43) */ @@ -1087,7 +1083,7 @@ int freebsd7_freebsd32_shmctl(struct thread *td, struct freebsd7_freebsd32_shmctl_args *uap) { - int error = 0; + int error; union { struct shmid_ds shmid_ds; struct shm_info shm_info; @@ -1114,11 +1110,11 @@ freebsd7_freebsd32_shmctl(struct thread CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); } - + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); if (error) goto done; - + /* Cases in which we need to copyout */ switch (uap->cmd) { case IPC_INFO: @@ -1172,7 +1168,7 @@ done: int freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) { - int error = 0; + int error; union { struct shmid_ds shmid_ds; struct shm_info shm_info; @@ -1184,7 +1180,7 @@ freebsd32_shmctl(struct thread *td, stru struct shminfo32 shminfo32; } u32; size_t sz; - + if (uap->cmd == IPC_SET) { if ((error = copyin(uap->buf, &u32.shmid_ds32, sizeof(u32.shmid_ds32)))) @@ -1199,11 +1195,11 @@ freebsd32_shmctl(struct thread *td, stru CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); } - + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); if (error) goto done; - + /* Cases in which we need to copyout */ switch (uap->cmd) { case IPC_INFO: @@ -1270,11 +1266,11 @@ struct freebsd7_shmctl_args { int freebsd7_shmctl(struct thread *td, struct freebsd7_shmctl_args *uap) { - int error = 0; + int error; struct shmid_ds_old old; struct shmid_ds buf; size_t bufsz; - + /* * The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support * Linux binaries. If we see the call come through the FreeBSD ABI, @@ -1297,7 +1293,7 @@ freebsd7_shmctl(struct thread *td, struc CP(old, buf, shm_dtime); CP(old, buf, shm_ctime); } - + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz); if (error) goto done;