Skip to contentSkip to conversation

block/iscsi: fix uninitialized variable

PATCH In review Peter Wu 2 participants 2 messages Dec 23, 2014 Block layer

lore
Share & tools
lore

Peter Wu

author
#0 lore raw

PATCH 1/1 block/iscsi: fix uninitialized variable

'ret' was never initialized in the success path.

---
Hi,

Found this warning when compiling with --enable-debug. This issue was previously fixed as part of Peter Lieven's patch series[1] but it never seemed to get merged.

Kinds regards,
Peter

[1]: https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg04279.html

---
 block/iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/iscsi.c +1 -1
index ed375fc..12ddbfb 100644
@@ -1286,7 +1286,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
     QemuOpts *opts;
     Error *local_err = NULL;
     const char *filename;
-    int i, ret;
+    int i, ret = 0;
 
     if ((BDRV_SECTOR_SIZE % 512) != 0) {
         error_setg(errp, "iSCSI: Invalid BDRV_SECTOR_SIZE. "
Signature · 1 line
2.2.1
#1 lore raw
Quoted 24 lines · Peter Wu

'ret' was never initialized in the success path.

---
Hi,

Found this warning when compiling with --enable-debug. This issue was previously fixed as part of Peter Lieven's patch series[1] but it never seemed to get merged.

Kinds regards,
Peter

[1]: https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg04279.html

---
 block/iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/iscsi.c +0 -0
index ed375fc..12ddbfb 100644

block/iscsi.c static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, · line 1292

Quoted 8 lines
block/iscsi.c +1 -1
@@ -1286,7 +1286,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
     QemuOpts *opts;
     Error *local_err = NULL;
     const char *filename;
-    int i, ret;
+    int i, ret = 0;
 
     if ((BDRV_SECTOR_SIZE % 512) != 0) {
         error_setg(errp, "iSCSI: Invalid BDRV_SECTOR_SIZE. "

Thanks.

Paolo