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
This commit is contained in:
Konstantin Belousov 2018-09-25 18:24:25 +00:00
parent af534f8d99
commit cbe100dfca

View File

@ -1966,10 +1966,10 @@ pmap_invalidate_all_pcid(pmap_t pmap, bool invpcid_works1)
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();