:::::: :::::: Manual check reason: "low confidence bisect report" :::::: Manual check reason: "low confidence static check warning: lib/zstd/decompress/zstd_decompress.c:1252:44: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]" ::::::
CC: [email protected] BCC: [email protected] CC: [email protected] TO: Nick Terrell <[email protected]> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 70664fc10c0d722ec79d746d8ac1db8546c94114 commit: e0c1b49f5b674cca7b10549c53b3791d0bbc90a8 lib: zstd: Upgrade to latest upstream zstd version 1.4.10 date: 9 months ago :::::: branch date: 22 hours ago :::::: commit date: 9 months ago config: arm-randconfig-c002-20220718 (https://download.01.org/0day-ci/archive/20220724/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0c1b49f5b674cca7b10549c53b3791d0bbc90a8 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout e0c1b49f5b674cca7b10549c53b3791d0bbc90a8 # save the config file ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <[email protected]> gcc-analyzer warnings: (new ones prefixed by >>) lib/zstd/decompress/zstd_decompress.c: In function 'ZSTD_loadDEntropy': >> lib/zstd/decompress/zstd_decompress.c:1252:44: warning: use of uninitialized >> value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 1252 | unsigned offcodeMaxValue = MaxOff, offcodeLog; | ^~~~~~~~~~ 'ZSTD_decompressBegin_usingDict.part.0': events 1-2 | | 1354 | size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to 'ZSTD_decompressBegin_usingDict.part.0' |...... | 1357 | if (dict && dictSize) | | ~ | | | | | (2) following 'true' branch... | 'ZSTD_decompressBegin_usingDict.part.0': event 3 | |lib/zstd/decompress/../common/zstd_internal.h:38:22: | 38 | #define ZSTD_isError ERR_isError /* for inlining */ lib/zstd/decompress/../common/zstd_internal.h:84:7: note: in definition of macro 'RETURN_ERROR_IF' | 84 | if (cond) { \ | | ^~~~ lib/zstd/decompress/zstd_decompress.c:1359:13: note: in expansion of macro 'ZSTD_isError' | 1359 | ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)), | | ^~~~~~~~~~~~ | 'ZSTD_decompressBegin_usingDict.part.0': event 4 | |lib/zstd/decompress/../common/zstd_internal.h:38:22: | 38 | #define ZSTD_isError ERR_isError /* for inlining */ lib/zstd/decompress/../common/zstd_internal.h:84:7: note: in definition of macro 'RETURN_ERROR_IF' | 84 | if (cond) { \ | | ^~~~ lib/zstd/decompress/zstd_decompress.c:1359:13: note: in expansion of macro 'ZSTD_isError' | 1359 | ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)), | | ^~~~~~~~~~~~ | +--> 'ZSTD_decompress_insertDictionary': events 5-6 | | 1309 | static size_t ZSTD_decompress_insertDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) entry to 'ZSTD_decompress_insertDictionary' | 1310 | { | 1311 | if (dictSize < 8) return ZSTD_refDictContent(dctx, dict, dictSize); | | ~ | | | | | (6) following 'false' branch (when 'dictSize > 7')... | 'ZSTD_decompress_insertDictionary': event 7 | |include/asm-generic/unaligned.h:14:15: | 14 | __pptr->x; \ | | ~~~~~~^~~ | | | | | (7) ...to here include/uapi/linux/byteorder/little_endian.h:34:51: note: in definition of macro '__le32_to_cpu' | 34 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | | ^ include/asm-generic/unaligned.h:32:28: note: in expansion of macro '__get_unaligned_t' | 32 | return le32_to_cpu(__get_unaligned_t(__le32, p)); | | ^~~~~~~~~~~~~~~~~ | 'ZSTD_decompress_insertDictionary': event 8 | |lib/zstd/decompress/zstd_decompress.c:1313:12: | 1313 | if (magic != ZSTD_MAGIC_DICTIONARY) { | | ^ | | | | | (8) following 'false' branch... | 'ZSTD_decompress_insertDictionary': event 9 | |include/asm-generic/unaligned.h:14:15: | 14 | __pptr->x; \ | | ~~~~~~^~~ | | | | | (9) ...to here include/uapi/linux/byteorder/little_endian.h:34:51: note: in definition of macro '__le32_to_cpu' | 34 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | | ^ include/asm-generic/unaligned.h:32:28: note: in expansion of macro '__get_unaligned_t' | 32 | return le32_to_cpu(__get_unaligned_t(__le32, p)); | | ^~~~~~~~~~~~~~~~~ | 'ZSTD_decompress_insertDictionary': event 10 | |lib/zstd/decompress/zstd_decompress.c:1319:30: | 1319 | { size_t const eSize = ZSTD_loadDEntropy(&dctx->entropy, dict, dictSize); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (10) calling 'ZSTD_loadDEntropy' from 'ZSTD_decompress_insertDictionary' | +--> 'ZSTD_loadDEntropy': event 11 | | 1222 | ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, | | ^~~~~~~~~~~~~~~~~ | | | | | (11) entry to 'ZSTD_loadDEntropy' | 'ZSTD_loadDEntropy': event 12 vim +1252 lib/zstd/decompress/zstd_decompress.c e0c1b49f5b674c Nick Terrell 2020-09-11 1217 e0c1b49f5b674c Nick Terrell 2020-09-11 1218 /*! ZSTD_loadDEntropy() : e0c1b49f5b674c Nick Terrell 2020-09-11 1219 * dict : must point at beginning of a valid zstd dictionary. e0c1b49f5b674c Nick Terrell 2020-09-11 1220 * @return : size of entropy tables read */ e0c1b49f5b674c Nick Terrell 2020-09-11 1221 size_t e0c1b49f5b674c Nick Terrell 2020-09-11 1222 ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, e0c1b49f5b674c Nick Terrell 2020-09-11 1223 const void* const dict, size_t const dictSize) e0c1b49f5b674c Nick Terrell 2020-09-11 1224 { e0c1b49f5b674c Nick Terrell 2020-09-11 1225 const BYTE* dictPtr = (const BYTE*)dict; e0c1b49f5b674c Nick Terrell 2020-09-11 1226 const BYTE* const dictEnd = dictPtr + dictSize; e0c1b49f5b674c Nick Terrell 2020-09-11 1227 e0c1b49f5b674c Nick Terrell 2020-09-11 1228 RETURN_ERROR_IF(dictSize <= 8, dictionary_corrupted, "dict is too small"); e0c1b49f5b674c Nick Terrell 2020-09-11 1229 assert(MEM_readLE32(dict) == ZSTD_MAGIC_DICTIONARY); /* dict must be valid */ e0c1b49f5b674c Nick Terrell 2020-09-11 1230 dictPtr += 8; /* skip header = magic + dictID */ e0c1b49f5b674c Nick Terrell 2020-09-11 1231 e0c1b49f5b674c Nick Terrell 2020-09-11 1232 ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, OFTable) == offsetof(ZSTD_entropyDTables_t, LLTable) + sizeof(entropy->LLTable)); e0c1b49f5b674c Nick Terrell 2020-09-11 1233 ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, MLTable) == offsetof(ZSTD_entropyDTables_t, OFTable) + sizeof(entropy->OFTable)); e0c1b49f5b674c Nick Terrell 2020-09-11 1234 ZSTD_STATIC_ASSERT(sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable) >= HUF_DECOMPRESS_WORKSPACE_SIZE); e0c1b49f5b674c Nick Terrell 2020-09-11 1235 { void* const workspace = &entropy->LLTable; /* use fse tables as temporary workspace; implies fse tables are grouped together */ e0c1b49f5b674c Nick Terrell 2020-09-11 1236 size_t const workspaceSize = sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable); e0c1b49f5b674c Nick Terrell 2020-09-11 1237 #ifdef HUF_FORCE_DECOMPRESS_X1 e0c1b49f5b674c Nick Terrell 2020-09-11 1238 /* in minimal huffman, we always use X1 variants */ e0c1b49f5b674c Nick Terrell 2020-09-11 1239 size_t const hSize = HUF_readDTableX1_wksp(entropy->hufTable, e0c1b49f5b674c Nick Terrell 2020-09-11 1240 dictPtr, dictEnd - dictPtr, e0c1b49f5b674c Nick Terrell 2020-09-11 1241 workspace, workspaceSize); e0c1b49f5b674c Nick Terrell 2020-09-11 1242 #else e0c1b49f5b674c Nick Terrell 2020-09-11 1243 size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable, e0c1b49f5b674c Nick Terrell 2020-09-11 1244 dictPtr, (size_t)(dictEnd - dictPtr), e0c1b49f5b674c Nick Terrell 2020-09-11 1245 workspace, workspaceSize); e0c1b49f5b674c Nick Terrell 2020-09-11 1246 #endif e0c1b49f5b674c Nick Terrell 2020-09-11 1247 RETURN_ERROR_IF(HUF_isError(hSize), dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1248 dictPtr += hSize; e0c1b49f5b674c Nick Terrell 2020-09-11 1249 } e0c1b49f5b674c Nick Terrell 2020-09-11 1250 e0c1b49f5b674c Nick Terrell 2020-09-11 1251 { short offcodeNCount[MaxOff+1]; e0c1b49f5b674c Nick Terrell 2020-09-11 @1252 unsigned offcodeMaxValue = MaxOff, offcodeLog; e0c1b49f5b674c Nick Terrell 2020-09-11 1253 size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, (size_t)(dictEnd-dictPtr)); e0c1b49f5b674c Nick Terrell 2020-09-11 1254 RETURN_ERROR_IF(FSE_isError(offcodeHeaderSize), dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1255 RETURN_ERROR_IF(offcodeMaxValue > MaxOff, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1256 RETURN_ERROR_IF(offcodeLog > OffFSELog, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1257 ZSTD_buildFSETable( entropy->OFTable, e0c1b49f5b674c Nick Terrell 2020-09-11 1258 offcodeNCount, offcodeMaxValue, e0c1b49f5b674c Nick Terrell 2020-09-11 1259 OF_base, OF_bits, e0c1b49f5b674c Nick Terrell 2020-09-11 1260 offcodeLog, e0c1b49f5b674c Nick Terrell 2020-09-11 1261 entropy->workspace, sizeof(entropy->workspace), e0c1b49f5b674c Nick Terrell 2020-09-11 1262 /* bmi2 */0); e0c1b49f5b674c Nick Terrell 2020-09-11 1263 dictPtr += offcodeHeaderSize; e0c1b49f5b674c Nick Terrell 2020-09-11 1264 } e0c1b49f5b674c Nick Terrell 2020-09-11 1265 e0c1b49f5b674c Nick Terrell 2020-09-11 1266 { short matchlengthNCount[MaxML+1]; e0c1b49f5b674c Nick Terrell 2020-09-11 1267 unsigned matchlengthMaxValue = MaxML, matchlengthLog; e0c1b49f5b674c Nick Terrell 2020-09-11 1268 size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, (size_t)(dictEnd-dictPtr)); e0c1b49f5b674c Nick Terrell 2020-09-11 1269 RETURN_ERROR_IF(FSE_isError(matchlengthHeaderSize), dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1270 RETURN_ERROR_IF(matchlengthMaxValue > MaxML, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1271 RETURN_ERROR_IF(matchlengthLog > MLFSELog, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1272 ZSTD_buildFSETable( entropy->MLTable, e0c1b49f5b674c Nick Terrell 2020-09-11 1273 matchlengthNCount, matchlengthMaxValue, e0c1b49f5b674c Nick Terrell 2020-09-11 1274 ML_base, ML_bits, e0c1b49f5b674c Nick Terrell 2020-09-11 1275 matchlengthLog, e0c1b49f5b674c Nick Terrell 2020-09-11 1276 entropy->workspace, sizeof(entropy->workspace), e0c1b49f5b674c Nick Terrell 2020-09-11 1277 /* bmi2 */ 0); e0c1b49f5b674c Nick Terrell 2020-09-11 1278 dictPtr += matchlengthHeaderSize; e0c1b49f5b674c Nick Terrell 2020-09-11 1279 } e0c1b49f5b674c Nick Terrell 2020-09-11 1280 e0c1b49f5b674c Nick Terrell 2020-09-11 1281 { short litlengthNCount[MaxLL+1]; e0c1b49f5b674c Nick Terrell 2020-09-11 1282 unsigned litlengthMaxValue = MaxLL, litlengthLog; e0c1b49f5b674c Nick Terrell 2020-09-11 1283 size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, (size_t)(dictEnd-dictPtr)); e0c1b49f5b674c Nick Terrell 2020-09-11 1284 RETURN_ERROR_IF(FSE_isError(litlengthHeaderSize), dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1285 RETURN_ERROR_IF(litlengthMaxValue > MaxLL, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1286 RETURN_ERROR_IF(litlengthLog > LLFSELog, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1287 ZSTD_buildFSETable( entropy->LLTable, e0c1b49f5b674c Nick Terrell 2020-09-11 1288 litlengthNCount, litlengthMaxValue, e0c1b49f5b674c Nick Terrell 2020-09-11 1289 LL_base, LL_bits, e0c1b49f5b674c Nick Terrell 2020-09-11 1290 litlengthLog, e0c1b49f5b674c Nick Terrell 2020-09-11 1291 entropy->workspace, sizeof(entropy->workspace), e0c1b49f5b674c Nick Terrell 2020-09-11 1292 /* bmi2 */ 0); e0c1b49f5b674c Nick Terrell 2020-09-11 1293 dictPtr += litlengthHeaderSize; e0c1b49f5b674c Nick Terrell 2020-09-11 1294 } e0c1b49f5b674c Nick Terrell 2020-09-11 1295 e0c1b49f5b674c Nick Terrell 2020-09-11 1296 RETURN_ERROR_IF(dictPtr+12 > dictEnd, dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1297 { int i; e0c1b49f5b674c Nick Terrell 2020-09-11 1298 size_t const dictContentSize = (size_t)(dictEnd - (dictPtr+12)); e0c1b49f5b674c Nick Terrell 2020-09-11 1299 for (i=0; i<3; i++) { e0c1b49f5b674c Nick Terrell 2020-09-11 1300 U32 const rep = MEM_readLE32(dictPtr); dictPtr += 4; e0c1b49f5b674c Nick Terrell 2020-09-11 1301 RETURN_ERROR_IF(rep==0 || rep > dictContentSize, e0c1b49f5b674c Nick Terrell 2020-09-11 1302 dictionary_corrupted, ""); e0c1b49f5b674c Nick Terrell 2020-09-11 1303 entropy->rep[i] = rep; e0c1b49f5b674c Nick Terrell 2020-09-11 1304 } } e0c1b49f5b674c Nick Terrell 2020-09-11 1305 e0c1b49f5b674c Nick Terrell 2020-09-11 1306 return (size_t)(dictPtr - (const BYTE*)dict); e0c1b49f5b674c Nick Terrell 2020-09-11 1307 } e0c1b49f5b674c Nick Terrell 2020-09-11 1308 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
