m32r: fix potential NULL-pointer dereference
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 14 Nov 2013 22:31:18 +0000 (14:31 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 00:32:15 +0000 (09:32 +0900)
Add missing check for memory allocation fail.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/m32r/include/asm/pgalloc.h

index 0fc7361989797d9a8c6fb6cc2a823367f75236e0..ac4208bcc5ad6d5f05ed75474db11035854de388 100644 (file)
@@ -43,6 +43,8 @@ static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
 {
        struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
 
+       if (!pte)
+               return NULL;
        pgtable_page_ctor(pte);
        return pte;
 }