svn commit: r311779 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Jan 9 10:31:40 UTC 2017


Author: kib
Date: Mon Jan  9 10:31:39 2017
New Revision: 311779
URL: https://svnweb.freebsd.org/changeset/base/311779

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/10/sys/kern/vfs_syscalls.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_syscalls.c
==============================================================================
--- stable/10/sys/kern/vfs_syscalls.c	Mon Jan  9 10:30:24 2017	(r311778)
+++ stable/10/sys/kern/vfs_syscalls.c	Mon Jan  9 10:31:39 2017	(r311779)
@@ -259,7 +259,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)
@@ -283,13 +283,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);


More information about the svn-src-all mailing list