Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754316AbbHOS1K (ORCPT ); Sat, 15 Aug 2015 14:27:10 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:35630 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbbHOS1J (ORCPT ); Sat, 15 Aug 2015 14:27:09 -0400 From: Alexander Kuleshov To: Andrew Morton Cc: Tony Luck , Pekka Enberg , Mel Gorman , Robin Holt , Tang Chen , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal Date: Sun, 16 Aug 2015 00:26:46 +0600 Message-Id: <1439663206-15484-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 857 Lines: 32 This patch adds a check for memblock_reserve() call in the memblock_virt_alloc_internal() function, because memblock_reserve() can return -errno on fail. Signed-off-by: Alexander Kuleshov --- mm/memblock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 87108e7..73427546 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1298,7 +1298,9 @@ again: return NULL; done: - memblock_reserve(alloc, size); + if (memblock_reserve(alloc, size)) + return NULL; + ptr = phys_to_virt(alloc); memset(ptr, 0, size); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/