Task #90865 - fixed.err
back to task #90865download
Error: SHELLCHECK_WARNING (CWE-140):
/usr/share/bash-completion/completions/flashrom.bash:36:16: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
# 34| ;;
# 35| '-p'|'--programmer')
# 36|-> COMPREPLY=( $(compgen -W "asm106x atavia buspirate_spi ch341a_spi ch347_spi dediprog developerbox_spi digilent_spi dirtyjtag_spi drkaiser dummy ft2232_spi gfxnvidia internal it8212 jlink_spi linux_mtd linux_spi nic3com nicintel nicintel_eeprom nicintel_spi nicrealtek ogp_spi pickit2_spi pony_spi raiden_debug_spi rayer_spi satamv satasii serprog stlinkv3_spi usbblaster_spi " -- $cur) )
# 37| return 0
# 38| ;;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 374| {
# 375| if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
# 376|-> flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378| flash->mst->spi.get_region(flash, addr, region);
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 374| {
# 375| if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
# 376|-> flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378| flash->mst->spi.get_region(flash, addr, region);
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
# 374| {
# 375| if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
# 376|-> flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378| flash->mst->spi.get_region(flash, addr, region);
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 376| flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378|-> flash->mst->spi.get_region(flash, addr, region);
# 379| } else {
# 380| region->name = strdup("");
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 376| flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378|-> flash->mst->spi.get_region(flash, addr, region);
# 379| } else {
# 380| region->name = strdup("");
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
# 376| flash->mst->opaque.get_region(flash, addr, region);
# 377| } else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
# 378|-> flash->mst->spi.get_region(flash, addr, region);
# 379| } else {
# 380| region->name = strdup("");
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 380| region->name = strdup("");
# 381| region->start = 0;
# 382|-> region->end = flashrom_flash_getsize(flash) - 1;
# 383| region->read_prot = false;
# 384| region->write_prot = false;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 380| region->name = strdup("");
# 381| region->start = 0;
# 382|-> region->end = flashrom_flash_getsize(flash) - 1;
# 383| region->read_prot = false;
# 384| region->write_prot = false;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
# 380| region->name = strdup("");
# 381| region->start = 0;
# 382|-> region->end = flashrom_flash_getsize(flash) - 1;
# 383| region->read_prot = false;
# 384| region->write_prot = false;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 597| get_flash_region(flash, addr, ®ion);
# 598|
# 599|-> read_len = min(start + len, region.end + 1) - addr;
# 600| uint8_t *rbuf = buf + addr - start;
# 601|
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 597| get_flash_region(flash, addr, ®ion);
# 598|
# 599|-> read_len = min(start + len, region.end + 1) - addr;
# 600| uint8_t *rbuf = buf + addr - start;
# 601|
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
# 597| get_flash_region(flash, addr, ®ion);
# 598|
# 599|-> read_len = min(start + len, region.end + 1) - addr;
# 600| uint8_t *rbuf = buf + addr - start;
# 601|
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 602| if (region.read_prot) {
# 603| if (flash->flags.skip_unreadable_regions) {
# 604|-> msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
# 605| "filling (%#08x..%#08x) with erased value instead.\n",
# 606| __func__, region.name, region.start, region.end,
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 602| if (region.read_prot) {
# 603| if (flash->flags.skip_unreadable_regions) {
# 604|-> msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
# 605| "filling (%#08x..%#08x) with erased value instead.\n",
# 606| __func__, region.name, region.start, region.end,
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
# 602| if (region.read_prot) {
# 603| if (flash->flags.skip_unreadable_regions) {
# 604|-> msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
# 605| "filling (%#08x..%#08x) with erased value instead.\n",
# 606| __func__, region.name, region.start, region.end,
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:860:25: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1664:21: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1664:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1682:38: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1684:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1693:22: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1695:27: call_function: calling ‘get_next_write’ from ‘read_erase_write_block’
# 858| }
# 859| for (i = 0; i < len / stride; i++) {
# 860|-> limit = min(stride, len - i * stride);
# 861| /* Are 'have' and 'want' identical? */
# 862| if (memcmp(have + i * stride, want + i * stride, limit)) {
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:878:29: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1664:21: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1664:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1682:38: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1684:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1693:22: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1695:27: call_function: calling ‘get_next_write’ from ‘read_erase_write_block’
# 876| }
# 877| if (need_write)
# 878|-> first_len = min(i * stride - rel_start, len);
# 879| *first_start += rel_start;
# 880| return first_len;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:1470:25: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1468| erased_contents = malloc(erase_len);
# 1469| if (!backup_contents || !erased_contents) {
# 1470|-> msg_cerr("Out of memory!\n");
# 1471| ret = 1;
# 1472| goto _free_ret;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:1470:25: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1468| erased_contents = malloc(erase_len);
# 1469| if (!backup_contents || !erased_contents) {
# 1470|-> msg_cerr("Out of memory!\n");
# 1471| ret = 1;
# 1472| goto _free_ret;
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:1477:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1475| memset(erased_contents, ERASED_VALUE(flashctx), erase_len);
# 1476|
# 1477|-> msg_cdbg("R");
# 1478| /* Merge data preceding the current region. */
# 1479| if (info->region_start > info->erase_start) {
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/flashrom.c:1477:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1475| memset(erased_contents, ERASED_VALUE(flashctx), erase_len);
# 1476|
# 1477|-> msg_cdbg("R");
# 1478| /* Merge data preceding the current region. */
# 1479| if (info->region_start > info->erase_start) {
Error: GCC_ANALYZER_WARNING (CWE-775):
flashrom-1.4.0/linux_mtd.c:62:22: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(__builtin_alloca_with_align(46, 8), "r")’
flashrom-1.4.0/linux_mtd.c:56:19: acquire_resource: opened here
flashrom-1.4.0/linux_mtd.c:56:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/linux_mtd.c:61:9: branch_false: ...to here
flashrom-1.4.0/linux_mtd.c:63:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/linux_mtd.c:64:17: throw: if ‘print’ throws an exception...
flashrom-1.4.0/linux_mtd.c:62:22: danger: ‘fopen(__builtin_alloca_with_align(46, 8), "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 60|
# 61| clearerr(fp);
# 62|-> bytes_read = fread(buf, 1, (size_t)len, fp);
# 63| if (!feof(fp) && ferror(fp)) {
# 64| msg_perr("Error occurred when reading %s\n", path);
Error: GCC_ANALYZER_WARNING (CWE-401):
flashrom-1.4.0/linux_mtd.c:62:22: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(__builtin_alloca_with_align(46, 8), "r")’
flashrom-1.4.0/linux_mtd.c:56:19: acquire_memory: allocated here
flashrom-1.4.0/linux_mtd.c:56:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/linux_mtd.c:61:9: branch_false: ...to here
flashrom-1.4.0/linux_mtd.c:63:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/linux_mtd.c:64:17: throw: if ‘print’ throws an exception...
flashrom-1.4.0/linux_mtd.c:62:22: danger: ‘fopen(__builtin_alloca_with_align(46, 8), "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
# 60|
# 61| clearerr(fp);
# 62|-> bytes_read = fread(buf, 1, (size_t)len, fp);
# 63| if (!feof(fp) && ferror(fp)) {
# 64| msg_perr("Error occurred when reading %s\n", path);