[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231229021220.7337-1-liuwei09@cestc.cn>
Date: Fri, 29 Dec 2023 10:12:20 +0800
From: Liu Wei <liuwei09@...tc.cn>
To: axboe@...nel.dk
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
liuwei09@...tc.cn
Subject: [PATCH] block/blk_mq: Only call kfree when set->tags isn't null
In function blk_mq_realloc_tag_set_tags, there is a check on set->tags,
but kfree should only be called when set->tags isn't null
Signed-off-by: Liu Wei <liuwei09@...tc.cn>
---
block/blk-mq.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ac18f802c027..07a3fc01d54b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4409,10 +4409,11 @@ static int blk_mq_realloc_tag_set_tags(struct blk_mq_tag_set *set,
if (!new_tags)
return -ENOMEM;
- if (set->tags)
+ if (set->tags) {
memcpy(new_tags, set->tags, set->nr_hw_queues *
sizeof(*set->tags));
- kfree(set->tags);
+ kfree(set->tags);
+ }
set->tags = new_tags;
for (i = set->nr_hw_queues; i < new_nr_hw_queues; i++) {
--
2.42.1
Powered by blists - more mailing lists