public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block
@ 2020-01-15 14:20 YueHaibing
  2020-01-15 16:05 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2020-01-15 14:20 UTC (permalink / raw)
  To: clm, josef, dsterba, nborisov; +Cc: linux-btrfs, linux-kernel, YueHaibing

In btrfs_rmap_block(), if kcalloc fails, it should return
-ENOMEM instead of 0.

Fixes: 767f58cdaf20 ("btrfs: Refactor btrfs_rmap_block to improve readability")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 fs/btrfs/block-group.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 8877af5..1485158 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1655,7 +1655,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start,
 	*stripe_len = io_stripe_size;
 out:
 	free_extent_map(em);
-	return 0;
+	return ret;
 }
 
 static int exclude_super_stripes(struct btrfs_block_group *cache)
-- 
2.7.4



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

* Re: [PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block
  2020-01-15 14:20 [PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block YueHaibing
@ 2020-01-15 16:05 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-01-15 16:05 UTC (permalink / raw)
  To: YueHaibing; +Cc: clm, josef, dsterba, nborisov, linux-btrfs, linux-kernel

On Wed, Jan 15, 2020 at 10:20:27PM +0800, YueHaibing wrote:
> In btrfs_rmap_block(), if kcalloc fails, it should return
> -ENOMEM instead of 0.
> 
> Fixes: 767f58cdaf20 ("btrfs: Refactor btrfs_rmap_block to improve readability")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Thanks, folded to the patch.

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

end of thread, other threads:[~2020-01-15 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-15 14:20 [PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block YueHaibing
2020-01-15 16:05 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox