diff options
author | kib <kib@FreeBSD.org> | 2017-01-09 10:26:02 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-01-09 10:26:02 +0000 |
commit | f91948fdd5322d9aae1e8785976df69612c1999f (patch) | |
tree | 753c287371bbc37626ad6ff6b582ff4d5753dca6 | |
parent | 26cb429e0dd33256a7bd46af30f0136640d64d06 (diff) | |
download | FreeBSD-src-f91948fdd5322d9aae1e8785976df69612c1999f.zip FreeBSD-src-f91948fdd5322d9aae1e8785976df69612c1999f.tar.gz |
MFC r311113:
There is no need to use temporary statfs buffer for fsid obliteration
and prison enforcement. Do it on the caller buffer directly.
-rw-r--r-- | sys/kern/vfs_syscalls.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index d6bbf67..5ebfb03 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -247,7 +247,7 @@ statfs_scale_blocks(struct statfs *sf, long max_size) 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 mount *mp, struct statfs *buf) 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); |