]> git.itanic.dy.fi Git - linux-stable/commit
nvmet: fix mar and mor off-by-one errors
authorDennis Maisenbacher <dennis.maisenbacher@wdc.com>
Tue, 6 Sep 2022 07:39:28 +0000 (09:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 08:47:16 +0000 (10:47 +0200)
commitddb0d1d4d4ff1ed82418a5e522e50a03ac3b98ae
treec4086affa26eaea5d5a67d3360ac45830af021f1
parent9280b9de09fcdff9f17abb3ca6f7e146922b9a10
nvmet: fix mar and mor off-by-one errors

[ Upstream commit b7e97872a65e1d57b4451769610554c131f37a0a ]

Maximum Active Resources (MAR) and Maximum Open Resources (MOR) are 0's
based vales where a value of 0xffffffff indicates that there is no limit.

Decrement the values that are returned by bdev_max_open_zones and
bdev_max_active_zones as the block layer helpers are not 0's based.
A 0 returned by the block layer helpers indicates no limit, thus convert
it to 0xffffffff (U32_MAX).

Fixes: aaf2e048af27 ("nvmet: add ZBD over ZNS backend support")
Suggested-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/target/zns.c