1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

vfs: avoid spurious memcpy in vfs_statfs

It is quite often called for the very same buffer.
This commit is contained in:
Mateusz Guzik 2020-07-10 06:46:42 +00:00
parent 8ce741ca77
commit 8c1f410c19
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363068

View File

@ -2173,7 +2173,8 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp)
* Filesystems only fill in part of the structure for updates, we
* have to read the entirety first to get all content.
*/
memcpy(sbp, &mp->mnt_stat, sizeof(*sbp));
if (sbp != &mp->mnt_stat)
memcpy(sbp, &mp->mnt_stat, sizeof(*sbp));
/*
* Set these in case the underlying filesystem fails to do so.