Blame SOURCES/lsscsi-0.32-fix-uninitialized-variable.patch

78d351
From db8d419ba39e4547de602ef1ff58cd97d5e1102d Mon Sep 17 00:00:00 2001
78d351
From: Tomas Bzatek <tbzatek@redhat.com>
78d351
Date: Wed, 11 Nov 2020 15:39:16 +0100
78d351
Subject: [PATCH] fix uninitialized variable
78d351
78d351
Error: UNINIT (CWE-457): [#def1]
78d351
lsscsi-032r164/src/lsscsi.c:3341: var_decl: Declaring variable "type" without initializer.
78d351
lsscsi-032r164/src/lsscsi.c:3586: uninit_use_in_call: Using uninitialized value "type" when calling "is_direct_access_dev".
78d351
  3584|                   my_strcopy(blkdir, buff, sizeof(blkdir));
78d351
  3585|                   value[0] = 0;
78d351
  3586|->                 if (! (is_direct_access_dev(type) &&
78d351
  3587|                          block_scan(blkdir) &&
78d351
  3588|                          if_directory_chdir(blkdir, ".") &&
78d351
---
78d351
 src/lsscsi.c | 3 ++-
78d351
 1 file changed, 2 insertions(+), 1 deletion(-)
78d351
78d351
diff --git a/src/lsscsi.c b/src/lsscsi.c
78d351
index 6544153..8a30299 100644
78d351
--- a/src/lsscsi.c
78d351
+++ b/src/lsscsi.c
78d351
@@ -3338,7 +3338,8 @@ one_sdev_entry(const char * dir_name, const char * devname,
78d351
                const struct lsscsi_opts * op)
78d351
 {
78d351
         bool get_wwn = false;
78d351
-        int type, n, vlen;
78d351
+        int type = 0;
78d351
+        int n, vlen;
78d351
         int devname_len = 13;
78d351
         char buff[LMAX_DEVPATH];
78d351
         char extra[LMAX_DEVPATH];
78d351
-- 
78d351
2.26.2
78d351