linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix page leakage
@ 2012-10-05 20:55 Josef Bacik
  2012-10-11 13:13 ` Stefan Behrens
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2012-10-05 20:55 UTC (permalink / raw)
  To: linux-btrfs

Alloc_dummy_extent_buffer will not free the first page in the eb array if we
fail to allocate a page, fix this.  Thanks,

Reported-by: David Sterba <dave@jikos.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/extent_io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 7dc69b3..64dc93f 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4104,7 +4104,7 @@ struct extent_buffer *alloc_dummy_extent_buffer(u64 start, unsigned long len)
 
 	return eb;
 err:
-	for (i--; i > 0; i--)
+	for (i--; i >= 0; i--)
 		__free_page(eb->pages[i]);
 	__free_extent_buffer(eb);
 	return NULL;
-- 
1.7.7.6


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

* Re: [PATCH] Btrfs: fix page leakage
  2012-10-05 20:55 [PATCH] Btrfs: fix page leakage Josef Bacik
@ 2012-10-11 13:13 ` Stefan Behrens
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Behrens @ 2012-10-11 13:13 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

On Fri, 5 Oct 2012 16:55:00 -0400, Josef Bacik wrote:
> Alloc_dummy_extent_buffer will not free the first page in the eb array if we
> fail to allocate a page, fix this.  Thanks,
> 
> Reported-by: David Sterba <dave@jikos.cz>
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
>  fs/btrfs/extent_io.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 7dc69b3..64dc93f 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -4104,7 +4104,7 @@ struct extent_buffer *alloc_dummy_extent_buffer(u64 start, unsigned long len)
>  
>  	return eb;
>  err:
> -	for (i--; i > 0; i--)
> +	for (i--; i >= 0; i--)
>  		__free_page(eb->pages[i]);
>  	__free_extent_buffer(eb);
>  	return NULL;
> 

gcc says "warning: comparison of unsigned expression >= 0 is always
true" because i is an unsigned long. And gcc is right this time.

Reviewed-And-Rejected-By: gcc

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

end of thread, other threads:[~2012-10-11 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05 20:55 [PATCH] Btrfs: fix page leakage Josef Bacik
2012-10-11 13:13 ` Stefan Behrens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).