* [PATCH] block/elevator: handle possible null pointer
@ 2021-12-21 8:10 Peng Hao
2021-12-21 15:26 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Peng Hao @ 2021-12-21 8:10 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel
There is a check for q->tag_set in the front of elevator_get_default,
and there should be a check here too.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
block/elevator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/elevator.c b/block/elevator.c
index 1f39f6e8ebb9..b7d0bead680c 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -636,7 +636,7 @@ static struct elevator_type *elevator_get_default(struct request_queue *q)
if (q->tag_set && q->tag_set->flags & BLK_MQ_F_NO_SCHED_BY_DEFAULT)
return NULL;
- if (q->nr_hw_queues != 1 &&
+ if (q->nr_hw_queues != 1 && q->tag_set &&
!blk_mq_is_shared_tags(q->tag_set->flags))
return NULL;
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block/elevator: handle possible null pointer
2021-12-21 8:10 [PATCH] block/elevator: handle possible null pointer Peng Hao
@ 2021-12-21 15:26 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-12-21 15:26 UTC (permalink / raw)
To: Peng Hao; +Cc: linux-block, linux-kernel
On 12/21/21 1:10 AM, Peng Hao wrote:
> There is a check for q->tag_set in the front of elevator_get_default,
> and there should be a check here too.
I always get suspicious when I see patches like that. Is the other check
valid? Why does it need to get checked? There's really no meat on the
bone in this commit message.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-21 15:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 8:10 [PATCH] block/elevator: handle possible null pointer Peng Hao
2021-12-21 15:26 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.