Skip to content

Commit

Permalink
[POWERPC] Fix return from pte_alloc_one() in out-of-memory case
Browse files Browse the repository at this point in the history
pte_alloc_one() is expected to return NULL if out of memory.
But it returns virt_to_page(NULL), which is not NULL.
This fixes it.

Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Akinobu Mita <mita@fixstars.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Akinobu Mita authored and Paul Mackerras committed Jun 2, 2007
1 parent 66b3092 commit a4c28ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/asm-powerpc/pgalloc-64.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
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)
Expand Down

0 comments on commit a4c28ab

Please sign in to comment.