powerpc: fix virt_to_page() with NULL
PATCH 1/1 powerpc: fix virt_to_page() with NULL
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 <[email protected]>
Signed-off-by Akinobu Mita <[email protected]>
--- include/asm-powerpc/pgalloc-64.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/asm-powerpc/pgalloc-64.h +2 -1
@@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kernestatic 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)