]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: rnbd-clt: Fix signedness bug in init_dev()
authorDan Carpenter <dan.carpenter@linaro.org>
Sat, 20 Dec 2025 08:46:10 +0000 (11:46 +0300)
committerJens Axboe <axboe@kernel.dk>
Sat, 20 Dec 2025 19:56:48 +0000 (12:56 -0700)
The "dev->clt_device_id" variable is set using ida_alloc_max() which
returns an int and in particular it returns negative error codes.
Change the type from u32 to int to fix the error checking.

Fixes: c9b5645fd8ca ("block: rnbd-clt: Fix leaked ID in init_dev()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rnbd/rnbd-clt.h

index a48e040abe639d65236cc5398094a8288b2768ae..fbc1ed766025c131bafde1ee5a675e748b950254 100644 (file)
@@ -112,7 +112,7 @@ struct rnbd_clt_dev {
        struct rnbd_queue       *hw_queues;
        u32                     device_id;
        /* local Idr index - used to track minor number allocations. */
-       u32                     clt_device_id;
+       int                     clt_device_id;
        struct mutex            lock;
        enum rnbd_clt_dev_state dev_state;
        refcount_t              refcount;