Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integer overflow coverity issues in CPU plugin: 1548297, 1548502, 1548522 #28261

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void AdaptivePooling::execute(dnnl::stream strm) {
auto dstStrides = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();

// unified strides array
const size_t tailDimsOffset = (isTailCFmt ? -1 : 0);
const ptrdiff_t tailDimsOffset = (isTailCFmt ? -1 : 0);
const size_t inStrides[5] = {srcStrides[0],
(isTailCFmt ? 1 : srcStrides[1]),
(spatialDimsCount == 3 ? srcStrides[2 + tailDimsOffset] : 0),
Expand Down
1 change: 1 addition & 0 deletions src/plugins/intel_cpu/src/nodes/batch_to_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void BatchToSpace::batchToSpaceKernel() {
size_t channels = (inShape5D[1] / blockSize);
channels = channels == 0 ? 1 : channels;
const size_t workAmount = inShape5D[0] * channels;
OPENVINO_ASSERT(workAmount > 0, errorPrefix, " has unsupported work amount == 0");

parallel_nt(0, [&](const int ithr, const int nthr) {
size_t start(0lu), end(0lu);
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/intel_cpu/src/nodes/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct SubgraphCodeGeneratorKey {
bool operator==(const SubgraphCodeGeneratorKey& rhs) const;

std::shared_ptr<Subgraph::SubgraphAttrs> attrs = nullptr;
uint8_t broadcasting_mask = 0;
uint32_t broadcasting_mask = 0;
};

struct SubgraphShapeInferResultKey {
Expand Down Expand Up @@ -738,8 +738,10 @@ Subgraph::ControlFlowPasses Subgraph::getControlFlowPasses() const {
return backend_passes;
}

uint8_t Subgraph::getBroadcastingMask(const std::vector<VectorDims>& input_shapes) {
uint8_t mask = 0;
uint32_t Subgraph::getBroadcastingMask(const std::vector<VectorDims>& input_shapes) {
uint32_t mask = 0;
OPENVINO_ASSERT(broadcastable_inputs.size() <= sizeof(mask) * CHAR_BIT,
"Incorrect size of broadcastable inputs of Subgraph");
for (const auto& broadcastable_input : broadcastable_inputs) {
const auto& shape = input_shapes[broadcastable_input.first];
mask = mask << 1;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/subgraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Subgraph : public Node {
std::pair<std::vector<ov::element::Type>, std::vector<ov::element::Type>> getIOPrecisions() const;

static uint64_t getBodyHash(const std::shared_ptr<snippets::op::Subgraph>& snippet);
uint8_t getBroadcastingMask(const std::vector<VectorDims>& input_shapes);
uint32_t getBroadcastingMask(const std::vector<VectorDims>& input_shapes);

using DataFlowPasses = std::vector<ov::snippets::pass::Manager::PositionedPassBase>;
using ControlFlowPasses = std::vector<ov::snippets::lowered::pass::PassPipeline::PositionedPassLowered>;
Expand Down
Loading