Dear coreboot folks,
if somebody is bored ;-), here is the output of Cppcheck for cbfstool to fix. :P
$ cppcheck --version Cppcheck 1.59 $ git describe 4.0-3991-g33e83ca $ cppcheck --enable=all . Checking cbfs-mkpayload.c... Checking cbfs-mkpayload.c: __APPLE__... 1/11 files checked 4% done Checking cbfs-mkstage.c... [cbfs-mkstage.c:170]: (error) Memory leak: buffer Checking cbfs-mkstage.c: __APPLE__... 2/11 files checked 7% done Checking cbfs_image.c... Checking cbfs_image.c: __APPLE__... 3/11 files checked 21% done Checking cbfstool.c... Checking cbfstool.c: __APPLE__... 4/11 files checked 28% done Checking common.c... [common.c:36] -> [common.c:37]: (style) Mismatching assignment and comparison, comparison 'inttest_lsb==18' is always false. [common.c:141]: (error) Resource leak: file [common.c:270]: (error) Resource leak: file Checking common.c: __APPLE__... 5/11 files checked 40% done Checking compress.c... Checking compress.c: __APPLE__... 6/11 files checked 40% done Checking fit.c... Checking fit.c: __APPLE__... 7/11 files checked 44% done Checking lzma/C/LzFind.c... Checking lzma/C/LzFind.c: _LZMA_NO_SYSTEM_SIZE_T... Checking lzma/C/LzFind.c: _LZMA_UINT32_IS_ULONG... Checking lzma/C/LzFind.c: _MSC_VER... Checking lzma/C/LzFind.c: _SZ_NO_INT_64... Checking lzma/C/LzFind.c: _WIN32... Checking lzma/C/LzFind.c: __cplusplus... 8/11 files checked 54% done Checking lzma/C/LzmaDec.c... [lzma/C/LzmaDec.c:673]: (style) Variable 'range' is assigned a value that is never used. [lzma/C/LzmaDec.c:673]: (style) Variable 'code' is assigned a value that is never used. Checking lzma/C/LzmaDec.c: _LZMA_NO_SYSTEM_SIZE_T... Checking lzma/C/LzmaDec.c: _LZMA_PROB32... Checking lzma/C/LzmaDec.c: _LZMA_SIZE_OPT... Checking lzma/C/LzmaDec.c: _LZMA_UINT32_IS_ULONG... Checking lzma/C/LzmaDec.c: _MSC_VER... Checking lzma/C/LzmaDec.c: _SZ_NO_INT_64... Checking lzma/C/LzmaDec.c: _WIN32... Checking lzma/C/LzmaDec.c: __cplusplus... 9/11 files checked 67% done Checking lzma/C/LzmaEnc.c... [lzma/C/LzmaEnc.c:1345]: (style) The scope of the variable 'nextRepMatchPrice' can be reduced. [lzma/C/LzmaEnc.c:1435]: (style) The scope of the variable 'nextRepMatchPrice' can be reduced. [lzma/C/LzmaEnc.c:2164]: (style) Variable 'allocaDummy' is assigned a value that is never used. Checking lzma/C/LzmaEnc.c: LZMA_LOG_BSR... [lzma/C/LzmaEnc.c:398] -> [lzma/C/LzmaEnc.c:398]: (style) Same expression on both sides of '||'. Checking lzma/C/LzmaEnc.c: SHOW_STAT... [lzma/C/LzmaEnc.c:807]: (warning) %d in format string (no. 1) requires a signed integer given in the argument list. Checking lzma/C/LzmaEnc.c: SHOW_STAT2... [lzma/C/LzmaEnc.c:1775]: (warning) %d in format string (no. 2) requires a signed integer given in the argument list. [lzma/C/LzmaEnc.c:1775]: (warning) %d in format string (no. 3) requires a signed integer given in the argument list. [lzma/C/LzmaEnc.c:1115]: (style) Unsigned variable 'position' can't be negative so it is unnecessary to test it. Checking lzma/C/LzmaEnc.c: _7ZIP_ST... [lzma/C/LzmaEnc.c:2083]: (warning) Redundant assignment of 'pp' to itself. [lzma/C/LzmaEnc.c:2083]: (warning) Assignment of function parameter has no effect outside the function. Checking lzma/C/LzmaEnc.c: _LZMA_NO_SYSTEM_SIZE_T... Checking lzma/C/LzmaEnc.c: _LZMA_PROB32... Checking lzma/C/LzmaEnc.c: _LZMA_UINT32_IS_ULONG... Checking lzma/C/LzmaEnc.c: _MSC_VER... Checking lzma/C/LzmaEnc.c: _SZ_NO_INT_64... Checking lzma/C/LzmaEnc.c: _WIN32... Checking lzma/C/LzmaEnc.c: __cplusplus... 10/11 files checked 97% done Checking lzma/lzma.c... Checking lzma/lzma.c: _LZMA_NO_SYSTEM_SIZE_T... Checking lzma/lzma.c: _LZMA_PROB32... Checking lzma/lzma.c: _LZMA_UINT32_IS_ULONG... Checking lzma/lzma.c: _MSC_VER... Checking lzma/lzma.c: _SZ_NO_INT_64... Checking lzma/lzma.c: _WIN32... Checking lzma/lzma.c: __APPLE__... Checking lzma/lzma.c: __cplusplus... 11/11 files checked 100% done Checking usage of global functions.. [lzma/C/LzFind.c:495]: (style) The function 'Bt3Zip_MatchFinder_GetMatches' is never used. [lzma/C/LzFind.c:660]: (style) The function 'Bt3Zip_MatchFinder_Skip' is never used. [lzma/C/LzFind.c:635]: (style) The function 'Hc3Zip_MatchFinder_GetMatches' is never used. [lzma/C/LzFind.c:721]: (style) The function 'Hc3Zip_MatchFinder_Skip' is never used. [lzma/C/LzmaDec.c:947]: (style) The function 'LzmaDec_Allocate' is never used. [lzma/C/LzmaDec.c:840]: (style) The function 'LzmaDec_DecodeToBuf' is never used. [lzma/C/LzmaDec.c:892]: (style) The function 'LzmaDec_Free' is never used. [lzma/C/LzmaEnc.c:76]: (style) The function 'LzmaEncProps_GetDictSize' is never used. [lzma/C/LzmaEnc.c:2250]: (style) The function 'LzmaEncode' is never used. [lzma/C/LzFind.c:108]: (style) The function 'MatchFinder_ReadIfRequired' is never used. [common.c:497]: (style) The function 'add_file_to_cbfs' is never used. [common.c:791]: (style) The function 'cbfs_find_location' is never used. [cbfs_image.c:782]: (style) The function 'cbfs_init_entry' is never used. [common.c:630]: (style) The function 'create_cbfs_file' is never used. [common.c:666]: (style) The function 'create_cbfs_image' is never used. [lzma/lzma.c:169]: (style) The function 'do_lzma_uncompress' is never used. [common.c:438]: (style) The function 'extract_file_from_cbfs' is never used. [cbfs_image.c:102]: (style) The function 'get_cbfs_compression' is never used. [cbfs_image.c:92]: (style) The function 'get_cbfs_entry_type' is never used. [common.c:106]: (style) The function 'getfilesize' is never used. [cbfs-mkstage.c:31]: (style) The function 'idemp' is never used. [common.c:348]: (style) The function 'print_cbfs_directory' is never used. [common.c:597]: (style) The function 'remove_file_from_cbfs' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details)
Thanks,
Paul
* Paul Menzel paulepanter@users.sourceforge.net [130409 00:51]:
Dear coreboot folks,
if somebody is bored ;-), here is the output of Cppcheck for cbfstool to fix. :P
Since you already started looking into the issue, maybe you can save the rest of us some time by following through with it yourself. A smart person once said:
And that is in my opinion disrespectful considering the time of others less valuable than ones own.
$ cppcheck --enable=all . Checking cbfs-mkpayload.c... Checking cbfs-mkpayload.c: __APPLE__...
Not sure what the above message implies.
You should probably report these to the authors of the LZMA SDK instead:
[lzma/C/LzmaDec.c:673]: (style) Variable 'range' is assigned a value that is never used. [lzma/C/LzmaDec.c:673]: (style) Variable 'code' is assigned a value that is never used. [lzma/C/LzmaEnc.c:1345]: (style) The scope of the variable 'nextRepMatchPrice' can be reduced. [lzma/C/LzmaEnc.c:1435]: (style) The scope of the variable 'nextRepMatchPrice' can be reduced. [lzma/C/LzmaEnc.c:2164]: (style) Variable 'allocaDummy' is assigned a value that is never used. [lzma/C/LzmaEnc.c:398] -> [lzma/C/LzmaEnc.c:398]: (style) Same expression on both sides of '||'. [lzma/C/LzmaEnc.c:807]: (warning) %d in format string (no. 1) requires a signed integer given in the argument list. [lzma/C/LzmaEnc.c:1775]: (warning) %d in format string (no. 2) requires a signed integer given in the argument list. [lzma/C/LzmaEnc.c:1775]: (warning) %d in format string (no. 3) requires a signed integer given in the argument list. [lzma/C/LzmaEnc.c:1115]: (style) Unsigned variable 'position' can't be negative so it is unnecessary to test it. [lzma/C/LzmaEnc.c:2083]: (warning) Redundant assignment of 'pp' to itself. [lzma/C/LzmaEnc.c:2083]: (warning) Assignment of function parameter has no effect outside the function. [lzma/C/LzFind.c:495]: (style) The function 'Bt3Zip_MatchFinder_GetMatches' is never used. [lzma/C/LzFind.c:660]: (style) The function 'Bt3Zip_MatchFinder_Skip' is never used. [lzma/C/LzFind.c:635]: (style) The function 'Hc3Zip_MatchFinder_GetMatches' is never used. [lzma/C/LzFind.c:721]: (style) The function 'Hc3Zip_MatchFinder_Skip' is never used. [lzma/C/LzmaDec.c:947]: (style) The function 'LzmaDec_Allocate' is never used. [lzma/C/LzmaDec.c:840]: (style) The function 'LzmaDec_DecodeToBuf' is never used. [lzma/C/LzmaDec.c:892]: (style) The function 'LzmaDec_Free' is never used. [lzma/C/LzmaEnc.c:76]: (style) The function 'LzmaEncProps_GetDictSize' is never used. [lzma/C/LzmaEnc.c:2250]: (style) The function 'LzmaEncode' is never used. [lzma/C/LzFind.c:108]: (style) The function 'MatchFinder_ReadIfRequired' is never used.
These should probably be looked at...
[cbfs-mkstage.c:170]: (error) Memory leak: buffer [common.c:36] -> [common.c:37]: (style) Mismatching assignment and comparison, comparison 'inttest_lsb==18' is always false. [common.c:141]: (error) Resource leak: file [common.c:270]: (error) Resource leak: file
[common.c:497]: (style) The function 'add_file_to_cbfs' is never used. [common.c:791]: (style) The function 'cbfs_find_location' is never used. [cbfs_image.c:782]: (style) The function 'cbfs_init_entry' is never used. [common.c:630]: (style) The function 'create_cbfs_file' is never used. [common.c:666]: (style) The function 'create_cbfs_image' is never used. [lzma/lzma.c:169]: (style) The function 'do_lzma_uncompress' is never used. [common.c:438]: (style) The function 'extract_file_from_cbfs' is never used. [cbfs_image.c:102]: (style) The function 'get_cbfs_compression' is never used. [cbfs_image.c:92]: (style) The function 'get_cbfs_entry_type' is never used. [common.c:106]: (style) The function 'getfilesize' is never used. [cbfs-mkstage.c:31]: (style) The function 'idemp' is never used. [common.c:348]: (style) The function 'print_cbfs_directory' is never used. [common.c:597]: (style) The function 'remove_file_from_cbfs' is never used.
Stefan