svn commit: r338928 - head/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Tue Sep 25 18:24:26 UTC 2018


Author: kib
Date: Tue Sep 25 18:24:25 2018
New Revision: 338928
URL: https://svnweb.freebsd.org/changeset/base/338928

Log:
  Fix an issue in r338862.
  
  For pmap_invalidate_all_pcid(), only reset pm_gen for non-kernel
  pmaps, as it was done before the conversion to ifuncs.  The reset is
  useless but innocent for kernel_pmap. Coverity reported that cpuid is
  used uninitialized in this case.
  
  Reported by:	cem
  Reviewed by:	alc, cem, markj
  CID:	 1395807
  Sponsored by:	The FreeBSD Foundation
  Approved by:	re (gjb)
  Differential revision:	https://reviews.freebsd.org/D17314

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Tue Sep 25 17:58:06 2018	(r338927)
+++ head/sys/amd64/amd64/pmap.c	Tue Sep 25 18:24:25 2018	(r338928)
@@ -1966,10 +1966,10 @@ pmap_invalidate_all_pcid(pmap_t pmap, bool invpcid_wor
 			critical_exit();
 		} else
 			pmap->pm_pcids[cpuid].pm_gen = 0;
-	}
-	CPU_FOREACH(i) {
-		if (cpuid != i)
-			pmap->pm_pcids[i].pm_gen = 0;
+		CPU_FOREACH(i) {
+			if (cpuid != i)
+				pmap->pm_pcids[i].pm_gen = 0;
+		}
 	}
 	/* See the comment in pmap_invalidate_page_pcid(). */
 	atomic_thread_fence_seq_cst();


More information about the svn-src-head mailing list