Date: Mon, 9 Jan 2017 10:26:02 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311776 - stable/11/sys/kern Message-ID: <201701091026.v09AQ2bf016159@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Jan 9 10:26:02 2017 New Revision: 311776 URL: https://svnweb.freebsd.org/changeset/base/311776 Log: MFC r311113: There is no need to use temporary statfs buffer for fsid obliteration and prison enforcement. Do it on the caller buffer directly. Modified: stable/11/sys/kern/vfs_syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Mon Jan 9 10:23:37 2017 (r311775) +++ stable/11/sys/kern/vfs_syscalls.c Mon Jan 9 10:26:02 2017 (r311776) @@ -247,7 +247,7 @@ statfs_scale_blocks(struct statfs *sf, l static int kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) { - struct statfs *sp, sb; + struct statfs *sp; int error; if (mp == NULL) @@ -271,13 +271,11 @@ kern_do_statfs(struct thread *td, struct error = VFS_STATFS(mp, sp); if (error != 0) goto out; + *buf = *sp; if (priv_check(td, PRIV_VFS_GENERATION)) { - bcopy(sp, &sb, sizeof(sb)); - sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; - prison_enforce_statfs(td->td_ucred, mp, &sb); - sp = &sb; + buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; + prison_enforce_statfs(td->td_ucred, mp, buf); } - *buf = *sp; out: vfs_unbusy(mp); return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701091026.v09AQ2bf016159>