Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jul 2020 06:46:42 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363068 - head/sys/kern
Message-ID:  <202007100646.06A6kgnX015296@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007100646.06A6kgnX015296>