From: "Yan, Zheng" <yanzheng03@xxxxxxxxxxxx> Device's minor is a 20-bits number, max value is 0xfffff. Fixes: b1a811633f ("block: nbd: add sanity check for first_minor"). Signed-off-by: "Yan, Zheng" <yanzheng03@xxxxxxxxxxxx> --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 1183f7872b71..53cd038c96e9 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1753,7 +1753,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs) * byte in __device_add_disk(). */ disk->first_minor = index << part_shift; - if (disk->first_minor > 0xff) { + if (disk->first_minor > MINORMASK) { err = -EINVAL; goto out_free_idr; } -- 2.12.2