Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jul 2012 12:59:00 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237924 - head/sys/i386/i386
Message-ID:  <201207011259.q61Cx0LR003284@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Sun Jul  1 12:59:00 2012
New Revision: 237924
URL: http://svn.freebsd.org/changeset/base/237924

Log:
  Replace an unreachable panic() in vm86_getptr (been there for 13 years) with
  a KASSERT() behind the functions's only consumer.
  
  Suggested by:	kib
  Reviewed by:	kib
  CID:		4494
  Found with:	Coverity Prevent(tm)
  MFC after:	2 weeks

Modified:
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/vm86.c

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Sun Jul  1 12:48:56 2012	(r237923)
+++ head/sys/i386/i386/machdep.c	Sun Jul  1 12:59:00 2012	(r237924)
@@ -2176,7 +2176,7 @@ basemem_setup(void)
 static void
 getmemsize(int first)
 {
-	int has_smap, off, physmap_idx, pa_indx, da_indx;
+	int has_smap, off, physmap_idx, pa_indx, da_indx, res;
 	u_long physmem_tunable, memtest;
 	vm_paddr_t physmap[PHYSMAP_SIZE];
 	pt_entry_t *pte;
@@ -2267,7 +2267,8 @@ getmemsize(int first)
 	pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT);
 	vmc.npages = 0;
 	smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT));
-	vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di);
+	res = vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di);
+	KASSERT(res != 0, ("vm86_getptr() failed: address not found"));
 
 	vmf.vmf_ebx = 0;
 	do {

Modified: head/sys/i386/i386/vm86.c
==============================================================================
--- head/sys/i386/i386/vm86.c	Sun Jul  1 12:48:56 2012	(r237923)
+++ head/sys/i386/i386/vm86.c	Sun Jul  1 12:59:00 2012	(r237924)
@@ -650,7 +650,6 @@ vm86_getptr(vmc, kva, sel, off)
 			return (1);
 		}
 	return (0);
-	panic("vm86_getptr: address not found");
 }
 	
 int



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