linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pte_alloc_kernel needs additional check
@ 2003-02-24 21:54 Paul Larson
  2003-02-24 22:33 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Larson @ 2003-02-24 21:54 UTC (permalink / raw)
  To: linux-mm, lkml

This applies against 2.5.63.
pte_alloc_kernel needs a check for pmd_present(*pmd) at the end.

Thanks,
Paul Larson

--- linux-2.5.63/mm/memory.c	Mon Feb 24 13:05:31 2003
+++ linux-2.5.63-fix/mm/memory.c	Mon Feb 24 15:45:05 2003
@@ -186,7 +186,9 @@
 		pmd_populate_kernel(mm, pmd, new);
 	}
 out:
-	return pte_offset_kernel(pmd, address);
+	if (pmd_present(*pmd))
+		return pte_offset_kernel(pmd, address);
+	return NULL;
 }
 #define PTE_TABLE_MASK	((PTRS_PER_PTE-1) * sizeof(pte_t))
 #define PMD_TABLE_MASK	((PTRS_PER_PMD-1) * sizeof(pmd_t))


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pte_alloc_kernel needs additional check
  2003-02-24 21:54 [PATCH] pte_alloc_kernel needs additional check Paul Larson
@ 2003-02-24 22:33 ` Andrew Morton
  2003-02-24 23:45   ` William Lee Irwin III
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-02-24 22:33 UTC (permalink / raw)
  To: Paul Larson; +Cc: linux-mm, linux-kernel

Paul Larson <plars@linuxtestproject.org> wrote:
>
> This applies against 2.5.63.
> pte_alloc_kernel needs a check for pmd_present(*pmd) at the end.
> 
> Thanks,
> Paul Larson
> 
> --- linux-2.5.63/mm/memory.c	Mon Feb 24 13:05:31 2003
> +++ linux-2.5.63-fix/mm/memory.c	Mon Feb 24 15:45:05 2003
> @@ -186,7 +186,9 @@
>  		pmd_populate_kernel(mm, pmd, new);
>  	}
>  out:
> -	return pte_offset_kernel(pmd, address);
> +	if (pmd_present(*pmd))
> +		return pte_offset_kernel(pmd, address);
> +	return NULL;
>  }
>  #define PTE_TABLE_MASK	((PTRS_PER_PTE-1) * sizeof(pte_t))
>  #define PMD_TABLE_MASK	((PTRS_PER_PMD-1) * sizeof(pmd_t))

Confused.  I cannot see a codepath which makes this test necessary?


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pte_alloc_kernel needs additional check
  2003-02-24 22:33 ` Andrew Morton
@ 2003-02-24 23:45   ` William Lee Irwin III
  0 siblings, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2003-02-24 23:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Paul Larson, linux-mm, linux-kernel

Paul Larson <plars@linuxtestproject.org> wrote:
-	return pte_offset_kernel(pmd, address);
+	if (pmd_present(*pmd))
+		return pte_offset_kernel(pmd, address);
+	return NULL;

On Mon, Feb 24, 2003 at 02:33:41PM -0800, Andrew Morton wrote:
> Confused.  I cannot see a codepath which makes this test necessary?

Looks like it's OOM handling by analogy with pte_alloc_map().

-- wli
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-24 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24 21:54 [PATCH] pte_alloc_kernel needs additional check Paul Larson
2003-02-24 22:33 ` Andrew Morton
2003-02-24 23:45   ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox