Author: mjg
Date: Fri Jul 10 06:46:42 2020
New Revision: 363068
URL: https://svnweb.freebsd.org/changeset/base/363068

Log:
  vfs: avoid spurious memcpy in vfs_statfs
  
  It is quite often called for the very same buffer.

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c   Fri Jul 10 00:45:34 2020        (r363067)
+++ head/sys/kern/vfs_mount.c   Fri Jul 10 06:46:42 2020        (r363068)
@@ -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.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to