All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal
@ 2015-08-15 18:26 ` Alexander Kuleshov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Kuleshov @ 2015-08-15 18:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Tony Luck, Pekka Enberg, Mel Gorman, Robin Holt, Tang Chen,
	linux-mm, linux-kernel, Alexander Kuleshov

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 <kuleshovmail@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal
@ 2015-08-15 18:26 ` Alexander Kuleshov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Kuleshov @ 2015-08-15 18:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Tony Luck, Pekka Enberg, Mel Gorman, Robin Holt, Tang Chen,
	linux-mm, linux-kernel, Alexander Kuleshov

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 <kuleshovmail@gmail.com>
---
 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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal
  2015-08-15 18:26 ` Alexander Kuleshov
@ 2015-08-17 21:59   ` Andrew Morton
  -1 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2015-08-17 21:59 UTC (permalink / raw)
  To: Alexander Kuleshov
  Cc: Tony Luck, Pekka Enberg, Mel Gorman, Robin Holt, Tang Chen,
	linux-mm, linux-kernel, Santosh Shilimkar

On Sun, 16 Aug 2015 00:26:46 +0600 Alexander Kuleshov <kuleshovmail@gmail.com> 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.  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal
@ 2015-08-17 21:59   ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2015-08-17 21:59 UTC (permalink / raw)
  To: Alexander Kuleshov
  Cc: Tony Luck, Pekka Enberg, Mel Gorman, Robin Holt, Tang Chen,
	linux-mm, linux-kernel, Santosh Shilimkar

On Sun, 16 Aug 2015 00:26:46 +0600 Alexander Kuleshov <kuleshovmail@gmail.com> 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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-17 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-15 18:26 [PATCH] mm/memblock: check memblock_reserve on fail in memblock_virt_alloc_internal Alexander Kuleshov
2015-08-15 18:26 ` Alexander Kuleshov
2015-08-17 21:59 ` Andrew Morton
2015-08-17 21:59   ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.