svn commit: r363068 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Fri Jul 10 06:46:43 UTC 2020


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.


More information about the svn-src-all mailing list