[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] avoid dereference of null pointer
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 2/2] avoid dereference of null pointer |
Date: |
Sun, 10 Nov 2013 16:53:39 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Sun 10 Nov 2013 16:46:30 +0100, a écrit :
> 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.
Well, it can never be null, since earlier in the code we see the pv_h
pointing to a map which has the physical page mapped somewhere.
> ---
> 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
>
>
--
Samuel
<N> M. MIMRAM Samuel Antonin
<N> en voila un qui etait predestiné
-+- #ens-mim - Quelles gueules qu'ils ont les ptits nouveaux ? -+-