[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221025105244.5212-1-zeming@nfschina.com>
Date: Tue, 25 Oct 2022 18:52:44 +0800
From: Li zeming <zeming@...china.com>
To: quwenruo.btrfs@....com, clm@...com, josef@...icpanda.com,
dsterba@...e.com, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Li zeming <zeming@...china.com>
Subject: [PATCH v2] btrfs: volumes: Increase bioc pointer check
This patch has the following changes:
1. Modify "is returned" in the comments to "should be returned".
2. Remove the __GFP_NOFAIL flag from the kzalloc function, which returns
NULL if kzalloc fails to allocate memory for bioc.
Reviewed-by: Qu Wenruo <wqu@...e.com>
Signed-off-by: Li zeming <zeming@...china.com>
---
v2: Add annotation vocabulary modify, remove __GFP_NOFAIL flag.
fs/btrfs/volumes.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 064ab2a79c80..b8d901f58995 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5891,7 +5891,9 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
* and the stripes.
*/
sizeof(u64) * (total_stripes),
- GFP_NOFS|__GFP_NOFAIL);
+ GFP_NOFS);
+ if (!bioc)
+ return NULL;
atomic_set(&bioc->error, 0);
refcount_set(&bioc->refs, 1);
@@ -6071,7 +6073,7 @@ struct btrfs_discard_stripe *btrfs_map_discard(struct btrfs_fs_info *fs_info,
* array of stripes.
* For READ, it also needs to be supported using the same mirror number.
*
- * If the requested block is not left of the left cursor, EIO is returned. This
+ * If the requested block is not left of the left cursor, EIO should be returned. This
* can happen because btrfs_num_copies() returns one more in the dev-replace
* case.
*/
--
2.18.2
Powered by blists - more mailing lists