Skip to content

Commit 0967074

Browse files
XinxiLiukeithbusch
authored andcommitted
nvme: fix FDP fdpcidx bounds check
The fdpcidx bounds check sets n = NUMFDPC + 1 but used > instead of >=, incorrectly accepting fdp_idx when it equals n (i.e. NUMFDPC + 1). Fixes: 30b5f20 ("nvme: register fdp parameters with the block layer") Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: liuxixin <gliuxen@gmail.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 8757fd9 commit 0967074

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ static int nvme_query_fdp_granularity(struct nvme_ctrl *ctrl,
22612261
}
22622262

22632263
n = le16_to_cpu(h->numfdpc) + 1;
2264-
if (fdp_idx > n) {
2264+
if (fdp_idx >= n) {
22652265
dev_warn(ctrl->device, "FDP index:%d out of range:%d\n",
22662266
fdp_idx, n);
22672267
/* Proceed without registering FDP streams */

0 commit comments

Comments
 (0)