Skip to contentSkip to conversation

block: rnbd-clt: Fix signedness bug in init_dev()

PATCH Applied Dan Carpenter 2 participants 2 messages Dec 20, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: rnbd-clt: Fix signedness bug in init_dev()

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()")
---
 drivers/block/rnbd/rnbd-clt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rnbd/rnbd-clt.h +1 -1
index a48e040abe63..fbc1ed766025 100644
@@ -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;
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

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.

Applied, thanks!

[1/1] block: rnbd-clt: Fix signedness bug in init_dev()

      commit: 1ddb815fdfd45613c32e9bd1f7137428f298e541

Best regards,

Signature · 1 line
Jens Axboe