diff options
author | Clayne Robison <clayne.b.robison@intel.com> | 2018-08-16 16:11:12 -0700 |
---|---|---|
committer | Clayne Robison <clayne.b.robison@intel.com> | 2018-08-16 16:11:12 -0700 |
commit | 1a00709a05115560a54d8c8a4d045353151708a8 (patch) | |
tree | 317f3dc8e67499c6a1e259abac886fad855344b7 /tensorflow/core/common_runtime/mkl_cpu_allocator.h | |
parent | afcf8a0ca10bb618f0a259952a82738fd267348f (diff) |
[Intel MKL] Static code analysis tool fixes
- mkl_cpu_allocator.h: disallowing copy constructor and assignement operator; returning nullptr from non-void functions even though they generate Unimplemented Status code
- mkl_graph_util.h: making kTensorOrdering const because it never gets changed anyway
- mkl_layout_pass.cc: adding checks for nullptr before dereferencing
Diffstat (limited to 'tensorflow/core/common_runtime/mkl_cpu_allocator.h')
-rw-r--r-- | tensorflow/core/common_runtime/mkl_cpu_allocator.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/core/common_runtime/mkl_cpu_allocator.h b/tensorflow/core/common_runtime/mkl_cpu_allocator.h index 99bd43e090..6b76e7e0e7 100644 --- a/tensorflow/core/common_runtime/mkl_cpu_allocator.h +++ b/tensorflow/core/common_runtime/mkl_cpu_allocator.h @@ -148,12 +148,14 @@ class MklCPUAllocator : public VisitableAllocator { Status s = Status(error::Code::UNIMPLEMENTED, "Unimplemented case for hooking MKL function."); TF_CHECK_OK(s); // way to assert with an error message + return nullptr; // return a value and make static code analyzers happy } static inline void* ReallocHook(void* ptr, size_t size) { Status s = Status(error::Code::UNIMPLEMENTED, "Unimplemented case for hooking MKL function."); TF_CHECK_OK(s); // way to assert with an error message + return nullptr; // return a value and make static code analyzers happy } /// Do we allow growth in BFC Allocator @@ -166,6 +168,9 @@ class MklCPUAllocator : public VisitableAllocator { static constexpr const size_t kAlignment = 64; VisitableAllocator* allocator_; // owned by this class + + // Prevent copying and assignment + TF_DISALLOW_COPY_AND_ASSIGN(MklCPUAllocator); }; } // namespace tensorflow |