Explorar o código

[LibOS] Don't use uninitialized return value in walk_mounts()

ret is declared without initialization. It depends on (ret = (*walk) (mount, arg) for the initial assignment;
however, the list might be NULL and the assignment can not be performed leaving ret in un-initialized state.
Thus ret should be properly initialized in this case.

Signed-off-by: Gary <gang1.wang@intel.com>
Gary %!s(int64=6) %!d(string=hai) anos
pai
achega
4a55dac44a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      LibOS/shim/src/fs/shim_fs.c

+ 1 - 1
LibOS/shim/src/fs/shim_fs.c

@@ -508,7 +508,7 @@ int walk_mounts (int (*walk) (struct shim_mount * mount, void * arg),
                  void * arg)
 {
     struct shim_mount * mount, * n;
-    int ret;
+    int ret = 0;
     int nsrched = 0;
 
     lock(mount_list_lock);