From 4a8a3df97505174080bc31601c97a3491856187a Mon Sep 17 00:00:00 2001 From: Pankaj Raghav Date: Tue, 25 Jan 2022 21:58:00 +0530 Subject: [PATCH] Kernel: Fix index calculation in NVMeQueue submit_sync_sqe function There was a bug while calculating the next index in submit_sync_sqe function. Use the NVMeQueue's class variable m_qdepth instead of the hardcoded IO_QUEUE_SIZE. --- Kernel/Storage/NVMe/NVMeQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Storage/NVMe/NVMeQueue.cpp b/Kernel/Storage/NVMe/NVMeQueue.cpp index 8871fce23e2..f61890c7c92 100644 --- a/Kernel/Storage/NVMe/NVMeQueue.cpp +++ b/Kernel/Storage/NVMe/NVMeQueue.cpp @@ -123,7 +123,7 @@ u16 NVMeQueue::submit_sync_sqe(NVMeSubmission& sub) SpinlockLocker lock(m_cq_lock); index = m_cq_head - 1; if (index < 0) - index = IO_QUEUE_SIZE - 1; + index = m_qdepth - 1; } cqe_cid = m_cqe_array[index].command_id; Scheduler::yield();