bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] avoid dereference of null pointer


From: Marin Ramesa
Subject: [PATCH 2/2] avoid dereference of null pointer
Date: Sun, 10 Nov 2013 16:46:30 +0100

Check to see if pte is a null pointer and perform dereference only
if that is not the case.

* i386/intel/pmap.c (pte): Check if it is a null pointer.

---
 i386/intel/pmap.c | 5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index c1eca6e..283992e 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -1567,8 +1567,9 @@ void pmap_page_protect(phys, prot)
                    /*
                     * Remove the mapping, collecting any modify bits.
                     */
-                   if (*pte & INTEL_PTE_WIRED)
-                       panic("pmap_remove_all removing a wired page");
+                       if (pte != NULL)
+                               if (*pte & INTEL_PTE_WIRED)
+                                       panic("pmap_remove_all removing a wired 
page");
 
                    {
                        register int    i = ptes_per_vm_page;
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]