Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:1452:39: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
# 1450|       /* free-threading note: the GIL is always enabled when this function is first called
# 1451|          by SWIG_init, so there's no risk of race conditions */
# 1452|->     Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE);
# 1453|   #elif PY_VERSION_HEX >= 0x03000000
# 1454|       Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:2440:22: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
# 2438|       slots
# 2439|     };
# 2440|->   PyObject *pytype = PyType_FromSpec(&spec);
# 2441|     PyObject *runtime_data_module = SWIG_runtime_data_module();
# 2442|   #if !defined(Py_LIMITED_API)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:2453:17: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
# 2451|   #endif
# 2452|   #endif
# 2453|->   if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0)
# 2454|       SWIG_Py_INCREF(pytype);
# 2455|     return (PyTypeObject *)pytype;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:2462:24: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
# 2460|   SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
# 2461|   {
# 2462|->   SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type());
# 2463|     if (sobj) {
# 2464|       sobj->ptr  = ptr;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:3136:16: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
# 3134|         }
# 3135|       } else {
# 3136|->       newobj = PyObject_New(SwigPyObject, clientdata->pytype);
# 3137|         if (newobj) {
# 3138|           newobj->swigdict = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4786:15: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4779:22: enter_function: entry to ‘_wrap_new_host_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4784:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_host_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4784:8: return_function: returning to ‘_wrap_new_host_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4784:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4785:32: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4785:32: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4786:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_host_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4786:15: return_function: returning to ‘_wrap_new_host_iter’ from ‘SWIG_Python_NewPointerObj’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4786:15: danger: ‘result’ leaks here; was allocated at [(9)](sarif:/runs/0/results/31/codeFlows/0/threadFlows/0/locations/8)
# 4784|     if (!SWIG_Python_UnpackTuple(args, "new_host_iter", 0, 0, 0)) SWIG_fail;
# 4785|     result = (struct host_iter *)calloc(1, sizeof(struct host_iter));
# 4786|->   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_host_iter, SWIG_POINTER_NEW |  0 );
# 4787|     return resultobj;
# 4788|   fail:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4997:15: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4990:22: enter_function: entry to ‘_wrap_new_subsystem_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4995:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_subsystem_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4995:8: return_function: returning to ‘_wrap_new_subsystem_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4995:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4996:37: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4996:37: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4997:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_subsystem_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4997:15: return_function: returning to ‘_wrap_new_subsystem_iter’ from ‘SWIG_Python_NewPointerObj’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:4997:15: danger: ‘result’ leaks here; was allocated at [(9)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/8)
# 4995|     if (!SWIG_Python_UnpackTuple(args, "new_subsystem_iter", 0, 0, 0)) SWIG_fail;
# 4996|     result = (struct subsystem_iter *)calloc(1, sizeof(struct subsystem_iter));
# 4997|->   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_subsystem_iter, SWIG_POINTER_NEW |  0 );
# 4998|     return resultobj;
# 4999|   fail:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5208:15: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5201:22: enter_function: entry to ‘_wrap_new_ctrl_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5206:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ctrl_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5206:8: return_function: returning to ‘_wrap_new_ctrl_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5206:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5207:32: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5207:32: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5208:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ctrl_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5208:15: return_function: returning to ‘_wrap_new_ctrl_iter’ from ‘SWIG_Python_NewPointerObj’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5208:15: danger: ‘result’ leaks here; was allocated at [(9)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/8)
# 5206|     if (!SWIG_Python_UnpackTuple(args, "new_ctrl_iter", 0, 0, 0)) SWIG_fail;
# 5207|     result = (struct ctrl_iter *)calloc(1, sizeof(struct ctrl_iter));
# 5208|->   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ctrl_iter, SWIG_POINTER_NEW |  0 );
# 5209|     return resultobj;
# 5210|   fail:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: warning[-Wanalyzer-malloc-leak]: leak of ‘result’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5466:22: enter_function: entry to ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: call_function: calling ‘SWIG_Python_UnpackTuple’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:8: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_UnpackTuple’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5471:6: branch_false: following ‘false’ branch...
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: branch_false: ...to here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5472:30: acquire_memory: allocated here
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: call_function: calling ‘SWIG_Python_NewPointerObj’ from ‘_wrap_new_ns_iter’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: return_function: returning to ‘_wrap_new_ns_iter’ from ‘SWIG_Python_NewPointerObj’
libnvme-1.15/redhat-linux-build/libnvme/nvme_wrap.c:5473:15: danger: ‘result’ leaks here; was allocated at [(9)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/8)
# 5471|     if (!SWIG_Python_UnpackTuple(args, "new_ns_iter", 0, 0, 0)) SWIG_fail;
# 5472|     result = (struct ns_iter *)calloc(1, sizeof(struct ns_iter));
# 5473|->   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ns_iter, SWIG_POINTER_NEW |  0 );
# 5474|     return resultobj;
# 5475|   fail:

Error: GCC_ANALYZER_WARNING (CWE-457): [#def10]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘buf’
libnvme-1.15/src/nvme/linux.c:293:5: enter_function: entry to ‘nvme_get_lba_status_log’
libnvme-1.15/src/nvme/linux.c:314:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:317:15: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:317:15: call_function: calling ‘nvme_get_log_lba_status’ from ‘nvme_get_lba_status_log’
libnvme-1.15/src/nvme/linux.c:295:52: call_function: inlined call to ‘freep’ from ‘nvme_get_lba_status_log’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ctrl’
libnvme-1.15/src/nvme/linux.c:400:16: throw: if ‘__nvme_alloc’ throws an exception...
libnvme-1.15/src/nvme/linux.c:397:45: call_function: inlined call to ‘freep’ from ‘nvme_get_ana_log_len’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def12]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘id_ctrl’
libnvme-1.15/src/nvme/linux.c:287:5: enter_function: entry to ‘nvme_get_new_host_telemetry’
libnvme-1.15/src/nvme/linux.c:290:16: call_function: calling ‘nvme_check_get_telemetry_log’ from ‘nvme_get_new_host_telemetry’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def13]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘log’
libnvme-1.15/src/nvme/linux.c:287:5: enter_function: entry to ‘nvme_get_new_host_telemetry’
libnvme-1.15/src/nvme/linux.c:290:16: call_function: calling ‘nvme_check_get_telemetry_log’ from ‘nvme_get_new_host_telemetry’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def14]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ns’
libnvme-1.15/src/nvme/linux.c:419:14: throw: if ‘__nvme_alloc’ throws an exception...
libnvme-1.15/src/nvme/linux.c:415:43: call_function: inlined call to ‘freep’ from ‘nvme_get_logical_block_size’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def15]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 1)’
libnvme-1.15/src/nvme/linux.c:438:14: acquire_resource: opened here
libnvme-1.15/src/nvme/linux.c:439:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:446:16: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:446:16: throw: if ‘write’ throws an exception...
libnvme-1.15/src/nvme/linux.c:436:26: call_function: inlined call to ‘cleanup_fd’ from ‘__nvme_set_attr’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libnvme-1.15/src/nvme/linux.c:317:15: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(16)’
libnvme-1.15/src/nvme/linux.c:293:5: enter_function: entry to ‘nvme_get_lba_status_log’
libnvme-1.15/src/nvme/linux.c:313:15: acquire_memory: allocated here
libnvme-1.15/src/nvme/linux.c:314:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:317:15: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:317:15: call_function: calling ‘nvme_get_log_lba_status’ from ‘nvme_get_lba_status_log’
libnvme-1.15/src/nvme/linux.c:317:15: danger: ‘malloc(16)’ leaks here; was allocated at [(2)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/1)
#  315|   		return -1;
#  316|   
#  317|-> 	err = nvme_get_log_lba_status(fd, true, 0, sizeof(*buf), buf);
#  318|   	if (err) {
#  319|   		*log = NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def17]
libnvme-1.15/src/nvme/linux.c:446:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 1)’
libnvme-1.15/src/nvme/linux.c:438:14: acquire_resource: opened here
libnvme-1.15/src/nvme/linux.c:439:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:446:16: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:446:16: danger: ‘open(path, 1)’ leaks here; was opened at [(1)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/0)
#  444|   		return -1;
#  445|   	}
#  446|-> 	return write(fd, value, strlen(value));
#  447|   }
#  448|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def18]
libnvme-1.15/src/nvme/linux.c:473:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 0)’
libnvme-1.15/src/nvme/linux.c:467:14: acquire_resource: opened here
libnvme-1.15/src/nvme/linux.c:468:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:471:15: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:473:9: danger: ‘open(path, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/0)
#  471|   	ret = read(fd, value, sizeof(value) - 1);
#  472|   	saved_errno = errno;
#  473|-> 	close(fd);
#  474|   	if (ret < 0) {
#  475|   		errno = saved_errno;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def19]
libnvme-1.15/src/nvme/linux.c:816:8: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘mac_ctx’
libnvme-1.15/src/nvme/linux.c:834:19: throw: if ‘OSSL_LIB_CTX_new’ throws an exception...
libnvme-1.15/src/nvme/linux.c:827:44: call_function: inlined call to ‘cleanup_evp_mac_ctx’ from ‘nvme_gen_dhchap_key’
#  814|   	cleanup_ossl_lib_ctx, OSSL_LIB_CTX *, OSSL_LIB_CTX_free)
#  815|   #define _cleanup_ossl_lib_ctx_ __cleanup__(cleanup_ossl_lib_ctx)
#  816|-> static DEFINE_CLEANUP_FUNC(cleanup_evp_mac_ctx, EVP_MAC_CTX *, EVP_MAC_CTX_free)
#  817|   #define _cleanup_evp_mac_ctx_ __cleanup__(cleanup_evp_mac_ctx)
#  818|   static DEFINE_CLEANUP_FUNC(cleanup_evp_mac, EVP_MAC *, EVP_MAC_free)

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-100.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namelibnvme-1.16.1-1.fc44
diffbase-store-results-to/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.tar.xz
diffbase-time-created2026-01-08 19:02:32
diffbase-time-finished2026-01-08 19:05:30
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-100.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibnvme-1.15-4.fc43
store-results-to/tmp/tmp7480oip5/libnvme-1.15-4.fc43.tar.xz
time-created2026-01-08 18:58:46
time-finished2026-01-08 19:02:14
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp7480oip5/libnvme-1.15-4.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp7480oip5/libnvme-1.15-4.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9