Skip to contentSkip to conversation

block/rnbd-clt: Fix error code in rnbd_clt_add_dev_symlink()

PATCH In review Dan Carpenter 3 participants 5 messages Dec 9, 2020

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

PATCH 1/1 block/rnbd-clt: Fix error code in rnbd_clt_add_dev_symlink()

The "ret" variable should be set to -ENOMEM but it returns uninitialized stack data.

Fixes 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")
---
 drivers/block/rnbd/rnbd-clt-sysfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/block/rnbd/rnbd-clt-sysfs.c +1 -0
index c3c96a567568..a5cd47b82b40 100644
@@ -499,6 +499,7 @@ static int rnbd_clt_add_dev_symlink(struct rnbd_clt_dev *dev)
 	dev->blk_symlink_name = kzalloc(len, GFP_KERNEL);
 	if (!dev->blk_symlink_name) {
 		rnbd_clt_err(dev, "Failed to allocate memory for blk_symlink_name\n");
+		ret = -ENOMEM;
 		goto out_err;
 	}
 
Signature · 1 line
2.29.2
#2 lore raw
In reply to Dan Carpenter

Hi Dan,

Quoted 6 lines · Dan Carpenter

The "ret" variable should be set to -ENOMEM but it returns uninitialized stack data.

Fixes 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

Thanks for the patch. But there is already a fix from Colin merged in block tree:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=for-5.11/drivers&ids3c15bd3a944b8eeaacdddf061759b6a83dd3f4

There is still other problem through with commit 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

I will send the fix today together with other changes.

Regards!
Jack

#3 lore raw
Quoted 16 lines · Jinpu Wang

Hi Dan,

Quoted 6 lines · Dan Carpenter

The "ret" variable should be set to -ENOMEM but it returns uninitialized stack data.

Fixes 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

Thanks for the patch. But there is already a fix from Colin merged in block tree:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=for-5.11/drivers&ids3c15bd3a944b8eeaacdddf061759b6a83dd3f4

Quoted 5 lines

There is still other problem through with commit 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

I will send the fix today together with other changes.

Ah... Haha... Sorry about that. We already discussed this yesterday.

What happens is that when I write a patch, I normally save it in my postponed messages until the next day. But then I decided to not fix it but instead to just report it. Unfortunately, I forgot to delete it and I also forgot about yesterday's discussion because I have the memory of a gnat. :P

regards,
dan carpenter

#4 lore raw
Quoted 26 lines · Dan Carpenter
Quoted 16 lines · Jinpu Wang

Hi Dan,

Quoted 6 lines · Dan Carpenter

The "ret" variable should be set to -ENOMEM but it returns uninitialized stack data.

Fixes 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

Thanks for the patch. But there is already a fix from Colin merged in block tree:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=for-5.11/drivers&ids3c15bd3a944b8eeaacdddf061759b6a83dd3f4

Quoted 5 lines

There is still other problem through with commit 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name")

I will send the fix today together with other changes.

Ah... Haha... Sorry about that. We already discussed this yesterday.

Quoted 9 lines

What happens is that when I write a patch, I normally save it in my postponed messages until the next day. But then I decided to not fix it but instead to just report it. Unfortunately, I forgot to delete it and I also forgot about yesterday's discussion because I have the memory of a gnat. :P

regards,
dan carpenter

No problem, thanks! :)