Re: [PATCH] md: bcache: check the return value of mempool_alloc() in bch_btree_node_read_done()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/25/22 4:28 PM, Jia-Ju Bai wrote:
The function mempool_alloc() in bch_btree_node_read_done() can fail, so
its return value should be checked.

Fixes: d19936a26658 ("bcache: convert to bioset_init()/mempool_init()")
Reported-by: TOTE Robot <oslab@xxxxxxxxxxxxxxx>
Signed-off-by: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>
---
  drivers/md/bcache/btree.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 88c573eeb598..fb8b7dd6bcc2 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -157,6 +157,8 @@ void bch_btree_node_read_done(struct btree *b)
  	 * See the comment arount cache_set->fill_iter.
  	 */
  	iter = mempool_alloc(&b->c->fill_iter, GFP_NOIO);
+	if (!iter)
+		return;


This is unnecessary, mempool_alloc() doesn't return NULL in this condition.


Coly Li



  	iter->size = b->c->cache->sb.bucket_size / b->c->cache->sb.block_size;
  	iter->used = 0;





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux