llvm-project/llvm/tools/llvm-mca
Ella Ma 1756d67934 [llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref
All these potential null pointer dereferences are reported by my static analyzer for null smart pointer dereferences, which has a different implementation from `alpha.cplusplus.SmartPtr`.

The checked pointers in this patch are initialized by Target::createXXX functions. When the creator function pointer is not correctly set, a null pointer will be returned, or the creator function may originally return a null pointer.

Some of them may not make sense as they may be checked before entering the function, but I fixed them all in this patch. I submit this fix because 1) similar checks are found in some other places in the LLVM codebase for the same return value of the function; and, 2) some of the pointers are dereferenced before they are checked, which may definitely trigger a null pointer dereference if the return value is nullptr.

Reviewed By: tejohnson, MaskRay, jpienaar

Differential Revision: https://reviews.llvm.org/D91410
2020-11-21 21:04:12 -08:00
..
Views [ARM][SchedModels] Convert IsPredicatedPred to MCSchedPredicate 2020-10-19 11:37:54 +03:00
CMakeLists.txt Remove AllTargetsAsmPrinters 2020-01-17 19:04:06 -05:00
CodeRegion.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CodeRegion.h Avoid including FileSystem.h from MemoryBuffer.h 2020-02-29 12:30:23 -08:00
CodeRegionGenerator.cpp [MC] Make MCStreamer aware of AsmParser's StartTokLoc 2020-11-02 12:32:07 -08:00
CodeRegionGenerator.h
PipelinePrinter.cpp
PipelinePrinter.h
llvm-mca.cpp [llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref 2020-11-21 21:04:12 -08:00