Error: GCC_ANALYZER_WARNING (CWE-476): [#def1] libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c: scope_hint: In function ‘main’ libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:157:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘e’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.h:14: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/libnvme.h:21: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:21: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:140:9: note: in expansion of macro ‘nvme_for_each_host’ /usr/include/sys/select.h:30: included_from: Included from here. /usr/include/sys/types.h:179: included_from: Included from here. /usr/include/stdlib.h:514: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:17: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:149:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:150:17: note: in expansion of macro ‘nvme_for_each_subsystem’ libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:150:17: note: in expansion of macro ‘nvme_for_each_subsystem’ libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:151:25: note: in expansion of macro ‘nvme_subsystem_for_each_ctrl’ libnvme-1.11-build/libnvme-1.11/examples/telemetry-listen.c:151:25: note: in expansion of macro ‘nvme_subsystem_for_each_ctrl’ # 155| continue; # 156| FD_SET(fd, &fds); # 157|-> e[i].uevent_fd = fd; # 158| e[i].c = c; # 159| i++; Error: GCC_ANALYZER_WARNING (CWE-401): [#def2] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘__nvmf_supported_options’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:722:12: warning[-Wanalyzer-malloc-leak]: leak of ‘*((struct nvme_root *)r).options’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1097:13: note: in expansion of macro ‘nvmf_check_option’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1097:13: note: in expansion of macro ‘nvmf_check_option’ # 720| # 721| r->options = calloc(1, sizeof(*r->options)); # 722|-> if (!r->options) # 723| return -ENOMEM; # 724| Error: GCC_ANALYZER_WARNING (CWE-775): [#def3] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘uuid_from_dmi_entries’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1333:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’ # 1331| continue; # 1332| sprintf(filename, "%s/%s/type", entries_dir, de->d_name); # 1333|-> f = open(filename, O_RDONLY); # 1334| if (f < 0) # 1335| continue; Error: GCC_ANALYZER_WARNING (CWE-775): [#def4] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1336:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’ # 1334| if (f < 0) # 1335| continue; # 1336|-> len = read(f, buf, 512); # 1337| close(f); # 1338| if (len <= 0) Error: GCC_ANALYZER_WARNING (CWE-775): [#def5] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1345:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’ # 1343| continue; # 1344| sprintf(filename, "%s/%s/raw", entries_dir, de->d_name); # 1345|-> f = open(filename, O_RDONLY); # 1346| if (f < 0) # 1347| continue; Error: GCC_ANALYZER_WARNING (CWE-775): [#def6] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1348:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’ # 1346| if (f < 0) # 1347| continue; # 1348|-> len = read(f, buf, 512); # 1349| close(f); # 1350| if (len <= 0) Error: GCC_ANALYZER_WARNING (CWE-775): [#def7] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘uuid_from_product_uuid’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1389:18: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/sys/class/dmi/id/product_uuid", "re")’ # 1387| size_t len = 0; # 1388| # 1389|-> stream = fopen(PATH_DMI_PROD_UUID, "re"); # 1390| if (!stream) # 1391| return -ENXIO; Error: GCC_ANALYZER_WARNING (CWE-401): [#def8] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1389:18: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/sys/class/dmi/id/product_uuid", "re")’ # 1387| size_t len = 0; # 1388| # 1389|-> stream = fopen(PATH_DMI_PROD_UUID, "re"); # 1390| if (!stream) # 1391| return -ENXIO; Error: GCC_ANALYZER_WARNING (CWE-688): [#def9] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘nvmf_is_registration_supported’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1793:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*c.dctype’ where non-null expected libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:18: included_from: Included from here. /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null # 1791| return false; # 1792| # 1793|-> return !strcmp(c->dctype, "ddc") || !strcmp(c->dctype, "cdc"); # 1794| } # 1795| Error: GCC_ANALYZER_WARNING (CWE-401): [#def10] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘nvme_parse_uri’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1825:24: warning[-Wanalyzer-malloc-leak]: leak of ‘unescape_uri(elem, 0)’ # 1823| # 1824| l = len > 0 ? len : strlen(str); # 1825|-> dst = malloc(l + 1); # 1826| for (i = 0, j = 0; i < l; i++, j++) { # 1827| if (str[i] == '%' && i + 2 < l && Error: GCC_ANALYZER_WARNING (CWE-476): [#def11] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c: scope_hint: In function ‘unescape_uri’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1829:32: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1811:24: note: in definition of macro ‘IS_XDIGIT’ libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1811:24: note: in definition of macro ‘IS_XDIGIT’ # 1827| if (str[i] == '%' && i + 2 < l && # 1828| IS_XDIGIT(str[i + 1]) && IS_XDIGIT(str[i + 2])) { # 1829|-> dst[j] = (XDIGIT_VAL(str[i + 1]) << 4) + # 1830| XDIGIT_VAL(str[i + 2]); # 1831| i += 2; Error: GCC_ANALYZER_WARNING (CWE-476): [#def12] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1833:32: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’ # 1831| i += 2; # 1832| } else # 1833|-> dst[j] = str[i]; # 1834| } # 1835| dst[j] = '\0'; Error: GCC_ANALYZER_WARNING (CWE-476): [#def13] libnvme-1.11-build/libnvme-1.11/src/nvme/fabrics.c:1835:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’ # 1833| dst[j] = str[i]; # 1834| } # 1835|-> dst[j] = '\0'; # 1836| return dst; # 1837| } Error: CPPCHECK_WARNING (CWE-758): [#def14] libnvme-1.11-build/libnvme-1.11/src/nvme/ioctl.c:1875: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1873| ((args->prinfor & 0xf) << 12) | ((args->dtype & 0xf) << 20) | # 1874| ((args->prinfow & 0xf) << 26) | ((args->fua & 0x1) << 30) | # 1875|-> ((args->lr & 0x1) << 31); # 1876| # 1877| if (args->args_size == size_v1) { Error: CPPCHECK_WARNING (CWE-401): [#def15] libnvme-1.11-build/libnvme-1.11/src/nvme/linux.c:1463: error[memleak]: Memory leak: identity # 1461| if (!psk) { # 1462| errno = ENOMEM; # 1463|-> return 0; # 1464| } # 1465| memset(psk, 0, key_len); Error: GCC_ANALYZER_WARNING (CWE-401): [#def16] libnvme-1.11-build/libnvme-1.11/src/nvme/linux.c: scope_hint: In function ‘__nvme_insert_tls_key’ libnvme-1.11-build/libnvme-1.11/src/nvme/linux.c:1792:22: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_import_tls_key_versioned(key, & version, & hmac, & key_len)’ # 1790| } # 1791| # 1792|-> if (_version != 1) { # 1793| errno = EINVAL; # 1794| return NULL; Error: CPPCHECK_WARNING (CWE-758): [#def17] libnvme-1.11-build/libnvme-1.11/src/nvme/mi.c:1703: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1701| (NVME_MI_MT_MI << 3); # 1702| req_hdr.opcode = nvme_mi_mi_opcode_subsys_health_status_poll; # 1703|-> req_hdr.cdw1 = (clear ? 1 : 0) << 31; # 1704| # 1705| memset(&req, 0, sizeof(req)); Error: GCC_ANALYZER_WARNING (CWE-476): [#def18] libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c: scope_hint: In function ‘read_discovery’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:478:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘d’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:557:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:559:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:566:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:567:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:568:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:569:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:570:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:580:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:586:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:592:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:593:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:595:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:17: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:104:25: note: in expansion of macro ‘nvme_msg’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:595:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:636:17: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:449:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:460:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:460:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:463:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:463:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:463:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c: scope_hint: In function ‘read_discovery’ # 476| nbft->filename, discovery->index); # 477| # 478|-> *d = discovery; # 479| r = 0; # 480| Error: GCC_ANALYZER_WARNING (CWE-131): [#def19] libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:511:29: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c: scope_hint: In function ‘parse_raw_nbft’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:557:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:559:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:566:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:567:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:568:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:569:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:570:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:580:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:586:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:592:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:593:9: note: in expansion of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:595:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:104:25: note: in expansion of macro ‘nvme_msg’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:595:13: note: in expansion of macro ‘get_heap_obj’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:77:23: note: in definition of macro ‘verify’ libnvme-1.11-build/libnvme-1.11/src/nvme/nbft.c:620:17: note: in expansion of macro ‘verify’ # 509| int i, cnt; # 510| # 511|-> nbft->security_list = calloc(num_sec + 1, sizeof(struct nbft_info_security)); # 512| for (i = 0, cnt = 0; i < num_sec; i++) { # 513| if (read_security(nbft, &raw_sec_array[i], &nbft->security_list[cnt]) == 0) Error: GCC_ANALYZER_WARNING (CWE-688): [#def20] libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘nvme_init_subsystem’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:784:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*s.subsysnqn’ where non-null expected libnvme-1.11-build/libnvme-1.11/src/nvme/filters.h:13: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:31: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:26: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:379:16: note: in expansion of macro ‘list_top’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘nvme_init_subsystem’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:37: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:1881:17: note: in expansion of macro ‘nvme_msg’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:659:9: note: in expansion of macro ‘nvme_for_each_subsystem’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:14: included_from: Included from here. /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null # 782| s->subsystype = nvme_get_attr(path, "subsystype"); # 783| if (!s->subsystype) { # 784|-> if (!strcmp(s->subsysnqn, NVME_DISC_SUBSYS_NAME)) # 785| s->subsystype = strdup("discovery"); # 786| else Error: GCC_ANALYZER_WARNING (CWE-476): [#def21] libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘nvme_ctrl_scan_namespaces’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:1850:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘r’ # 1848| int i; # 1849| # 1850|-> if (r->create_only) { # 1851| nvme_msg(r, LOG_DEBUG, "skipping namespace scan for ctrl %s\n", # 1852| c->name); Error: GCC_ANALYZER_WARNING (CWE-401): [#def22] libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘nvme_scan_ctrl’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:1872:31: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ctrl_lookup_subsystem_name(r, name)’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:379:16: note: in expansion of macro ‘list_top’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘nvme_scan_ctrl’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:715:9: note: in expansion of macro ‘nvme_for_each_host’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:1881:17: note: in expansion of macro ‘nvme_msg’ # 1870| if (subsys.num < 0) # 1871| return NULL; # 1872|-> for (i = 0; i < subsys.num; i++) { # 1873| struct stat st; # 1874| _cleanup_free_ char *path = NULL; Error: GCC_ANALYZER_WARNING (CWE-401): [#def23] libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:2289:12: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’ # 2287| void nvme_ns_release_fd(nvme_ns_t n) # 2288| { # 2289|-> if (n->fd < 0) # 2290| return; # 2291| Error: GCC_ANALYZER_WARNING (CWE-401): [#def24] libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c:2646:50: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_ns_open(path, nvme_ns_generic_to_blkdev(name))’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’ libnvme-1.11-build/libnvme-1.11/src/nvme/tree.c: scope_hint: In function ‘__nvme_scan_namespace’ # 2644| # 2645| for (i = 0; i < size; i++) { # 2646|-> struct sysfs_attr_table *e = &tbl[i]; # 2647| # 2648| str = nvme_get_attr(path, e->name); Error: CPPCHECK_WARNING (CWE-758): [#def25] libnvme-1.11-build/libnvme-1.11/src/nvme/types.h:1676: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1674| NVME_CTRL_OAES_ANSAN = NVME_VAL(CTRL_OAES_ANSAN), # 1675| NVME_CTRL_OAES_ZD = NVME_VAL(CTRL_OAES_ZD), # 1676|-> NVME_CTRL_OAES_DL = NVME_VAL(CTRL_OAES_DL), # 1677| }; # 1678| Error: CPPCHECK_WARNING (CWE-758): [#def26] libnvme-1.11-build/libnvme-1.11/src/nvme/types.h:8570: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 8568| NVME_FEATURE_AENCFG_NOTICE_LBA_STATUS = 1 << 13, # 8569| NVME_FEATURE_AENCFG_NOTICE_EG_EVENT = 1 << 14, # 8570|-> NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE = 1 << 31, # 8571| }; # 8572| Error: CPPCHECK_WARNING (CWE-404): [#def27] libnvme-1.11-build/libnvme-1.11/src/nvme/util.c:778: error[resourceLeak]: Resource leak: file # 776| # 777| if (!p) # 778|-> return 0; # 779| # 780| /* Strip unwanted trailing chars */ Error: CPPCHECK_WARNING (CWE-404): [#def28] libnvme-1.11-build/libnvme-1.11/src/nvme/util.c:784: error[resourceLeak]: Resource leak: file # 782| *bufsz -= len; # 783| # 784|-> return len; # 785| } # 786| Error: CPPCHECK_WARNING (CWE-562): [#def29] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:519: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 517| # 518| peer->tx_fn = tx_mpr; # 519|-> peer->tx_data = &tx_info; # 520| # 521| rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info); Error: CPPCHECK_WARNING (CWE-562): [#def30] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:537: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 535| # 536| peer->tx_fn = tx_mpr; # 537|-> peer->tx_data = &tx_info; # 538| # 539| ctrl = nvme_mi_init_ctrl(ep, 1); Error: CPPCHECK_WARNING (CWE-562): [#def31] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:562: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 560| # 561| peer->tx_fn = tx_mpr; # 562|-> peer->tx_data = &tx_info; # 563| # 564| ctrl = nvme_mi_init_ctrl(ep, 1); Error: CPPCHECK_WARNING (CWE-562): [#def32] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:649: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 647| # 648| peer->tx_fn = tx_fn_mpr_poll; # 649|-> peer->tx_data = &tx_info; # 650| # 651| peer->poll_fn = poll_fn_mpr_poll; Error: CPPCHECK_WARNING (CWE-562): [#def33] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:652: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 650| # 651| peer->poll_fn = poll_fn_mpr_poll; # 652|-> peer->poll_data = &poll_info; # 653| # 654| rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info); Error: CPPCHECK_WARNING (CWE-562): [#def34] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:678: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 676| # 677| peer->tx_fn = tx_fn_mpr_poll; # 678|-> peer->tx_data = &tx_info; # 679| # 680| peer->poll_fn = poll_fn_mpr_poll; Error: CPPCHECK_WARNING (CWE-562): [#def35] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:681: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 679| # 680| peer->poll_fn = poll_fn_mpr_poll; # 681|-> peer->poll_data = &poll_info; # 682| # 683| rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info); Error: CPPCHECK_WARNING (CWE-562): [#def36] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:707: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 705| # 706| peer->tx_fn = tx_fn_mpr_poll; # 707|-> peer->tx_data = &tx_info; # 708| # 709| peer->poll_fn = poll_fn_mpr_poll; Error: CPPCHECK_WARNING (CWE-562): [#def37] libnvme-1.11-build/libnvme-1.11/test/mi-mctp.c:710: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 708| # 709| peer->poll_fn = poll_fn_mpr_poll; # 710|-> peer->poll_data = &poll_info; # 711| # 712| rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info); Error: CPPCHECK_WARNING (CWE-457): [#def38] libnvme-1.11-build/libnvme-1.11/test/mi.c:948: warning[uninitvar]: Uninitialized variable: exp # 946| assert(args.data_len == sizeof(tstamp)); # 947| assert(tstamp.attr == 1); # 948|-> assert(!memcmp(tstamp.timestamp, exp, sizeof(tstamp.timestamp))); # 949| } # 950| Error: GCC_ANALYZER_WARNING (CWE-476): [#def39] libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c:38:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘storage’ libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c: scope_hint: In function ‘getifaddrs’ # 36| # 37| p = &storage->ifa; # 38|-> p->ifa_next = last ? NULL : &storage[1].ifa; # 39| p->ifa_name = storage->name; # 40| strcpy(p->ifa_name, ifname); Error: GCC_ANALYZER_WARNING (CWE-401): [#def40] libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c: scope_hint: In function ‘getifaddrs’ libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c:117:16: warning[-Wanalyzer-malloc-leak]: leak of ‘storage’ libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c:7: included_from: Included from here. libnvme-1.11-build/libnvme-1.11/test/mock-ifaddrs.c: scope_hint: In function ‘getifaddrs’ # 115| init_entry(&storage[3], "lo", AF_INET6, 0, 0, 0, 1, true); /* ::1 */ # 116| # 117|-> return 0; # 118| } # 119|
analyzer-version-clippy | 1.82.0 |
analyzer-version-cppcheck | 2.16.0 |
analyzer-version-gcc | 14.2.1 |
analyzer-version-gcc-analyzer | 15.0.0 |
analyzer-version-shellcheck | 0.10.0 |
analyzer-version-unicontrol | 0.0.2 |
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
exit-code | 0 |
host | ip-172-16-1-189.us-west-2.compute.internal |
mock-config | fedora-rawhide-gcc-latest-x86_64 |
project-name | libnvme-1.11-1.fc42 |
store-results-to | /tmp/tmputj_65gk/libnvme-1.11-1.fc42.tar.xz |
time-created | 2024-11-13 01:38:26 |
time-finished | 2024-11-13 01:41:14 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmputj_65gk/libnvme-1.11-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmputj_65gk/libnvme-1.11-1.fc42.src.rpm' |
tool-version | csmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9 |