From 6daa0da3c6eeb9cf7535b4832da3bfefc3d5d7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Holz?= Date: Sun, 3 Mar 2024 22:07:38 +0100 Subject: [PATCH] Kernel/NVMe: Fix calculation of "Maximum Queue Entries Supported" field The value of this field is incremented by one, as a value of 0 for this field means 1 entry supported. A value of 0xffff for CAP.MQES would incorrectly by truncated to 0x0000, if we don't increase the bit width of the return type. --- Kernel/Devices/Storage/NVMe/NVMeDefinitions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Devices/Storage/NVMe/NVMeDefinitions.h b/Kernel/Devices/Storage/NVMe/NVMeDefinitions.h index 92999fb212..8e541e263e 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeDefinitions.h +++ b/Kernel/Devices/Storage/NVMe/NVMeDefinitions.h @@ -54,7 +54,7 @@ static constexpr u8 CAP_DBL_SHIFT = 32; static constexpr u8 CAP_DBL_MASK = 0xf; static constexpr u8 CAP_TO_SHIFT = 24; static constexpr u64 CAP_TO_MASK = 0xff << CAP_TO_SHIFT; -static constexpr u16 MQES(u64 cap) +static constexpr u32 MQES(u64 cap) { return (cap & 0xffff) + 1; }