Re: [PATCH -next] nbd: fix possible overflow on 'first_minor' in nbd_dev_add()

From: Jens Axboe
Date: Wed Apr 06 2022 - 11:38:36 EST


On 4/6/22 5:24 AM, Zhang Wensheng wrote:
> When 'index' is a big numbers, it may become negative which forced
> to 'int'. then 'index << part_shift' might overflow to a positive
> value that is not greater than '0xfffff', then sysfs might complains
> about duplicate creation. Because of this, move the 'index' judgment
> to the front will fix it and be better.

What's changed in this version? Always add a v2 to both the subject
line and below the '---' so that folks reviewing this will know
what changes you made since the last posting.

--
Jens Axboe