Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Aug 2020 14:22:32 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364457 - head/sys/amd64/amd64
Message-ID:  <202008211422.07LEMWVL093744@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Fri Aug 21 14:22:32 2020
New Revision: 364457
URL: https://svnweb.freebsd.org/changeset/base/364457

Log:
  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

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

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Fri Aug 21 13:11:33 2020	(r364456)
+++ head/sys/amd64/amd64/pmap.c	Fri Aug 21 14:22:32 2020	(r364457)
@@ -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");
 	}



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