amd64 pmap: potential integer overflowing expression

Coverity has identified the line in this change as "Potential integer
overflowing expression" due to the variable i declared as an int
and used in an expression with vm_paddr_t, a 64bit variable.

This change has very little effect as when this line is execute
nkpt is small and phys_addr is a the beginning of physical memory.
But there is no explicit protection that the above is true.

Submitted by:	bret_ketchum@dell.com
Reported by:	Coverity
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26141
This commit is contained in:
Eric van Gyzen 2020-08-21 14:22:32 +00:00
parent 2a99bea578
commit d17136fc3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364457

View File

@ -2111,7 +2111,7 @@ pmap_init(void)
* Collect the page table pages that were replaced by a 2MB
* page in create_pagetables(). They are zero filled.
*/
if (i << PDRSHIFT < KERNend &&
if ((vm_paddr_t)i << PDRSHIFT < KERNend &&
pmap_insert_pt_page(kernel_pmap, mpte, false))
panic("pmap_init: pmap_insert_pt_page failed");
}