linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix virt_to_page() with NULL
@ 2007-05-29 10:46 Akinobu Mita
  0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2007-05-29 10:46 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

pte_alloc_one() is expected to return NULL if out of memory.
But it returns virt_to_page(NULL) and it is not NULL.

Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Akinobu Mita <mita@fixstars.com>

---
 include/asm-powerpc/pgalloc-64.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: 2.6-rc-ps3/include/asm-powerpc/pgalloc-64.h
===================================================================
--- 2.6-rc-ps3.orig/include/asm-powerpc/pgalloc-64.h
+++ 2.6-rc-ps3/include/asm-powerpc/pgalloc-64.h
@@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kerne
 static inline struct page *pte_alloc_one(struct mm_struct *mm,
 					 unsigned long address)
 {
-	return virt_to_page(pte_alloc_one_kernel(mm, address));
+	pte_t *pte = pte_alloc_one_kernel(mm, address);
+	return pte ? virt_to_page(pte) : NULL;
 }
 
 static inline void pte_free_kernel(pte_t *pte)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-29 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 10:46 [PATCH] powerpc: fix virt_to_page() with NULL Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).