Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:724:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘iter’
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9576:22: enter_function: entry to ‘_wrap_fdt_strerror’
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9585:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9587:12: branch_false: ...to here
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9587:12: call_function: calling ‘SWIG_AsVal_int’ from ‘_wrap_fdt_strerror’
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9587:12: return_function: returning to ‘_wrap_fdt_strerror’ from ‘SWIG_AsVal_int’
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9588:6: branch_false: following ‘false’ branch...
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9591:3: branch_false: ...to here
dtc-1.7.2/./pylibfdt/libfdt_wrap.c:9593:15: call_function: calling ‘SWIG_FromCharPtr’ from ‘_wrap_fdt_strerror’
#  722|     swig_module_info *iter = start;
#  723|     do {
#  724|->     if (iter->size) {
#  725|         size_t l = 0;
#  726|         size_t r = iter->size - 1;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def2]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1327:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*yy_cp’
dtc-1.7.2/convert-dtsv0-lexer.l:216:5: enter_function: entry to ‘main’
dtc-1.7.2/convert-dtsv0-lexer.l:226:12: branch_false: following ‘false’ branch (when ‘argc > 1’)...
dtc-1.7.2/convert-dtsv0-lexer.l:226:12: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:229:21: branch_true: following ‘true’ branch (when ‘i < argc’)...
dtc-1.7.2/convert-dtsv0-lexer.l:230:78: branch_true: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:231:17: call_function: calling ‘convert_file’ from ‘main’
# 1325|   
# 1326|   	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
# 1327|-> 		{
# 1328|   		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
# 1329|   		if ( yy_accept[yy_current_state] )

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1508:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘yyin’
dtc-1.7.2/convert-dtsv0-lexer.l:190:13: enter_function: entry to ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: call_function: calling ‘xmalloc’ from ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: return_function: returning to ‘convert_file’ from ‘xmalloc’
dtc-1.7.2/convert-dtsv0-lexer.l:200:16: acquire_resource: opened here
dtc-1.7.2/convert-dtsv0-lexer.l:201:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:205:17: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:210:15: call_function: calling ‘yylex’ from ‘convert_file’
# 1506|   {
# 1507|       	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
# 1508|-> 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
# 1509|   	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
# 1510|   	(yy_hold_char) = *(yy_c_buf_p);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1508:9: warning[-Wanalyzer-malloc-leak]: leak of ‘yyin’
dtc-1.7.2/convert-dtsv0-lexer.l:190:13: enter_function: entry to ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: call_function: calling ‘xmalloc’ from ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: return_function: returning to ‘convert_file’ from ‘xmalloc’
dtc-1.7.2/convert-dtsv0-lexer.l:200:16: acquire_memory: allocated here
dtc-1.7.2/convert-dtsv0-lexer.l:201:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:205:17: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:210:15: call_function: calling ‘yylex’ from ‘convert_file’
# 1506|   {
# 1507|       	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
# 1508|-> 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
# 1509|   	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
# 1510|   	(yy_hold_char) = *(yy_c_buf_p);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1531:54: warning[-Wanalyzer-malloc-leak]: leak of ‘yyalloc(64)’
dtc-1.7.2/convert-dtsv0-lexer.l:190:13: enter_function: entry to ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: call_function: calling ‘xmalloc’ from ‘convert_file’
dtc-1.7.2/convert-dtsv0-lexer.l:196:19: return_function: returning to ‘convert_file’ from ‘xmalloc’
dtc-1.7.2/convert-dtsv0-lexer.l:201:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:205:17: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: following ‘false’ branch...
dtc-1.7.2/convert-dtsv0-lexer.l:206:12: branch_false: ...to here
dtc-1.7.2/convert-dtsv0-lexer.l:210:15: call_function: calling ‘yylex’ from ‘convert_file’
# 1529|   	/* yy_ch_buf has to be 2 characters longer than the size given because
# 1530|   	 * we need to put in 2 end-of-buffer characters.
# 1531|-> 	 */
# 1532|   	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
# 1533|   	if ( ! b->yy_ch_buf )

Error: CPPCHECK_WARNING (CWE-476): [#def6]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1572: warning[nullPointer]: Possible null pointer dereference: b
# 1570|       
# 1571|   	yy_flush_buffer( b );
# 1572|-> 
# 1573|   	b->yy_input_file = file;
# 1574|   	b->yy_fill_buffer = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def7]
dtc-1.7.2/convert-dtsv0-lexer.lex.c:1573: warning[nullPointer]: Possible null pointer dereference: b
# 1571|   	yy_flush_buffer( b );
# 1572|   
# 1573|-> 	b->yy_input_file = file;
# 1574|   	b->yy_fill_buffer = 1;
# 1575|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
dtc-1.7.2/dtc-lexer.lex.c:1745:54: warning[-Wanalyzer-malloc-leak]: leak of ‘yyalloc(64)’
dtc-1.7.2/dtc-lexer.lex.c:1732:21: enter_function: entry to ‘yy_create_buffer’
dtc-1.7.2/dtc-lexer.lex.c:1736:24: call_function: calling ‘yyalloc’ from ‘yy_create_buffer’
dtc-1.7.2/dtc-lexer.lex.c:1736:24: return_function: returning to ‘yy_create_buffer’ from ‘yyalloc’
dtc-1.7.2/dtc-lexer.lex.c:1737:12: branch_false: following ‘false’ branch...
dtc-1.7.2/dtc-lexer.lex.c:1740:2: branch_false: ...to here
dtc-1.7.2/dtc-lexer.lex.c:1745:54: danger: ‘yyalloc(64)’ leaks here; was allocated at [(4)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/3)
# 1743|   	/* yy_ch_buf has to be 2 characters longer than the size given because
# 1744|   	 * we need to put in 2 end-of-buffer characters.
# 1745|-> 	 */
# 1746|   	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
# 1747|   	if ( ! b->yy_ch_buf )

Error: CPPCHECK_WARNING (CWE-476): [#def9]
dtc-1.7.2/dtc-lexer.lex.c:1786: warning[nullPointer]: Possible null pointer dereference: b
# 1784|       
# 1785|   	yy_flush_buffer( b );
# 1786|-> 
# 1787|   	b->yy_input_file = file;
# 1788|   	b->yy_fill_buffer = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def10]
dtc-1.7.2/dtc-lexer.lex.c:1787: warning[nullPointer]: Possible null pointer dereference: b
# 1785|   	yy_flush_buffer( b );
# 1786|   
# 1787|-> 	b->yy_input_file = file;
# 1788|   	b->yy_fill_buffer = 1;
# 1789|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
dtc-1.7.2/dtc-lexer.lex.c:2000:26: warning[-Wanalyzer-malloc-leak]: leak of ‘yyalloc(n)’
dtc-1.7.2/dtc-lexer.lex.c:1984:17: enter_function: entry to ‘yy_scan_bytes’
dtc-1.7.2/dtc-lexer.lex.c:1993:24: call_function: calling ‘yyalloc’ from ‘yy_scan_bytes’
dtc-1.7.2/dtc-lexer.lex.c:1993:24: return_function: returning to ‘yy_scan_bytes’ from ‘yyalloc’
dtc-1.7.2/dtc-lexer.lex.c:1994:12: branch_false: following ‘false’ branch...
dtc-1.7.2/dtc-lexer.lex.c:1994:12: branch_false: ...to here
dtc-1.7.2/dtc-lexer.lex.c:2002:6: call_function: calling ‘yy_scan_buffer’ from ‘yy_scan_bytes’
# 1998|   	for ( i = 0; i < _yybytes_len; ++i )
# 1999|   		buf[i] = yybytes[i];
# 2000|-> 
# 2001|   	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
# 2002|   

Error: CPPCHECK_WARNING (CWE-457): [#def12]
dtc-1.7.2/pylibfdt/libfdt_wrap.c:872: warning[uninitvar]: Uninitialized variable: buff
#  870|       *r = 0;
#  871|     }
#  872|->   return buff;
#  873|   }
#  874|   

Error: CPPCHECK_WARNING (CWE-476): [#def13]
dtc-1.7.2/pylibfdt/libfdt_wrap.c:1901: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1899|       SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
# 1900|       /* the klass element */
# 1901|->     data->klass = obj;
# 1902|       SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */

Error: CPPCHECK_WARNING (CWE-476): [#def14]
dtc-1.7.2/pylibfdt/libfdt_wrap.c:1902: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1900|       /* the klass element */
# 1901|       data->klass = obj;
# 1902|->     SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */
# 1904|       if (PyClass_Check(obj)) {

Scan Properties

analyzer-version-clippy1.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.95.0
diffbase-analyzer-version-cppcheck2.20.0
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
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-38.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.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namedtc-1.8.1-1.fc45
diffbase-store-results-to/tmp/tmpp79hx2ir/dtc-1.8.1-1.fc45.tar.xz
diffbase-time-created2026-06-01 12:01:11
diffbase-time-finished2026-06-01 12:02:47
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpp79hx2ir/dtc-1.8.1-1.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpp79hx2ir/dtc-1.8.1-1.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-38.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namedtc-1.7.2-9.fc44
store-results-to/tmp/tmp06y8yftk/dtc-1.7.2-9.fc44.tar.xz
time-created2026-06-01 11:58:48
time-finished2026-06-01 12:00:56
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmp06y8yftk/dtc-1.7.2-9.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp06y8yftk/dtc-1.7.2-9.fc44.src.rpm'
tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9