Skip to contentSkip to conversation

block/rnbd-clt-sysfs: fix a couple uninitialized variable bugs

PATCH Applied Dan Carpenter 3 participants 3 messages Oct 12, 2021

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

PATCH 1/1 block/rnbd-clt-sysfs: fix a couple uninitialized variable bugs

These variables are printed on the error path if match_int() fails so they have to be initialized.

Fixes 2958a995edc9 ("block/rnbd-clt: Support polling mode for IO latency optimization")
Fixes 1eb54f8f5dd8 ("block/rnbd: client: sysfs interface functions")
---
 drivers/block/rnbd/rnbd-clt-sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/rnbd/rnbd-clt-sysfs.c +3 -1
index 4b93fd83bf79..44e45af00e83 100644
@@ -71,8 +71,10 @@ static int rnbd_clt_parse_map_options(const char *buf, size_t max_path_cnt,
 	int opt_mask = 0;
 	int token;
 	int ret = -EINVAL;
-	int i, dest_port, nr_poll_queues;
+	int nr_poll_queues = 0;
+	int dest_port = 0;
 	int p_cnt = 0;
+	int i;
 
 	options = kstrdup(buf, GFP_KERNEL);
 	if (!options)
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 28 lines · Dan Carpenter

These variables are printed on the error path if match_int() fails so they have to be initialized.

Fixes 2958a995edc9 ("block/rnbd-clt: Support polling mode for IO latency optimization")
Fixes 1eb54f8f5dd8 ("block/rnbd: client: sysfs interface functions")
---
 drivers/block/rnbd/rnbd-clt-sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/rnbd/rnbd-clt-sysfs.c +3 -2
index 4b93fd83bf79..44e45af00e83 100644
@@ -71,8 +71,10 @@ static int rnbd_clt_parse_map_options(const char *buf, size_t max_path_cnt,
        int opt_mask = 0;
        int token;
        int ret = -EINVAL;
-       int i, dest_port, nr_poll_queues;
+       int nr_poll_queues = 0;
+       int dest_port = 0;
        int p_cnt = 0;
+       int i;
 
        options = kstrdup(buf, GFP_KERNEL);
        if (!options)
--
Quoted 2 lines

2.20.1

Thank you.

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

These variables are printed on the error path if match_int() fails so they have to be initialized.

Applied, thanks.

Signature · 1 line
Jens Axboe