Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751321AbbHQV7e (ORCPT ); Mon, 17 Aug 2015 17:59:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48288 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbbHQV7d (ORCPT ); Mon, 17 Aug 2015 17:59:33 -0400 Date: Mon, 17 Aug 2015 14:59:32 -0700 From: Andrew Morton To: Alexander Kuleshov Cc: Tony Luck , Pekka Enberg , Mel Gorman , Robin Holt , Tang Chen , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Santosh Shilimkar Subject: Re: [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal Message-Id: <20150817145932.68fe9460c4392a0c3907392a@linux-foundation.org> In-Reply-To: <1439663206-15484-1-git-send-email-kuleshovmail@gmail.com> References: <1439663206-15484-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 858 Lines: 29 On Sun, 16 Aug 2015 00:26:46 +0600 Alexander Kuleshov wrote: > This patch adds a check for memblock_reserve() call in the > memblock_virt_alloc_internal() function, because memblock_reserve() > can return -errno on fail. > > ... > > --- 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); This shouldn't ever happen. If it *does* happen, something is messed up and we should warn. -- 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/