Commit 7653e3ac authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] missing NULL pointer check in pte_alloc_one.

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Just found an small bug in pgalloc for s390*.  Comparing notes with other
architectures I found that pte_alloc_one is sick for alpha and sparc64 as
well.
parent d15128eb
......@@ -63,7 +63,10 @@ pte_free_kernel(pte_t *pte)
static inline struct page *
pte_alloc_one(struct mm_struct *mm, unsigned long addr)
{
return virt_to_page(pte_alloc_one_kernel(mm, addr));
pte_t *pte = pte_alloc_one_kernel(mm, addr);
if (pte)
return virt_to_page(pte);
return 0;
}
static inline void
......
......@@ -139,7 +139,10 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
static inline struct page *
pte_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
{
return virt_to_page(pte_alloc_one_kernel(mm, vmaddr));
pte_t *pte = pte_alloc_one_kernel(mm, vmaddr);
if (pte)
return virt_to_page(pte);
return 0;
}
static inline void pte_free_kernel(pte_t *pte)
......
......@@ -189,7 +189,15 @@ static __inline__ void free_pmd_slow(pmd_t *pmd)
pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address);
#define pte_alloc_one(MM,ADDR) virt_to_page(pte_alloc_one_kernel(MM,ADDR))
static inline struct page *
pte_alloc_one(struct mm_struct *mm, unsigned long addr)
{
pte_t *pte = pte_alloc_one_kernel(mm, addr);
if (pte)
return virt_to_page(pte);
return 0;
}
static __inline__ pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment