lkml.org 
[lkml]   [2022]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] btrfs: volumes: Increase bioc pointer check
Date
If kzalloc fails to allocate the bioc pointer, NULL is returned
directly.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
fs/btrfs/volumes.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 064ab2a79c80..f9cb815fe23d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5892,6 +5892,8 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
*/
sizeof(u64) * (total_stripes),
GFP_NOFS|__GFP_NOFAIL);
+ if (!bioc)
+ return NULL;

atomic_set(&bioc->error, 0);
refcount_set(&bioc->refs, 1);
--
2.18.2
\
 
 \ /
  Last update: 2022-10-25 10:29    [W:0.094 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site