The following issues were found
test/cpp_extensions/cpp_c10d_extension.cpp
1 issues
Line: 118
return c10::make_intrusive<ProcessGroupTest>(rank, size);
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("createProcessGroupTest", &ProcessGroupTest::createProcessGroupTest);
}
} // namespace c10d
Reported by Cppcheck.
caffe2/utils/fixed_divisor_test.cc
1 issues
Line: 33
} // namespace
TEST(FixedDivisorTest, FixedDivisorInt32Test) {
constexpr int32_t kMax = std::numeric_limits<int32_t>::max();
// divide by 1
CompareDivMod(kMax, 1);
CompareDivMod(0, 1);
Reported by Cppcheck.
caffe2/utils/fatal_signal_asan_no_sig_test.cc
1 issues
Line: 61
Column: 25
CWE codes:
120
20
}
ssize_t bytesRead;
while ((bytesRead = read(stderrPipe[0], buffer.data(), bufferSize)) > 0) {
const std::string tmp(buffer.data(), bytesRead);
std::cout << tmp;
stderrBuffer += tmp;
}
Reported by FlawFinder.
caffe2/transforms/pattern_net_transform_test.cc
1 issues
Line: 52
*
* R = ---> (Op3) ---> (Op3) --->
*/
TEST(PatternNetTransformTest, TestGenerateTransform) {
Workspace ws;
ws.CreateBlob("in");
NetDef netdef;
AddOp(&netdef, "DummyCounterOp1", {"in"}, {"mid1"});
Reported by Cppcheck.
caffe2/transforms/conv_to_nnpack_transform_test.cc
1 issues
Line: 12
using transform::Graph;
TEST(ConvToNNPackTest, TestSimple) {
NetDef netdef;
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
OperatorDef* op;
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
op = AddOp(&netdef, "Conv", {"in"}, {"out"});
Reported by Cppcheck.
caffe2/transforms/common_subexpression_elimination_test.cc
1 issues
Line: 22
* \-->(Relu)
*
*/
TEST(CommonSubexpressionEliminationTest, TestSimple) {
NetDef netdef;
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
OperatorDef* op;
// This operator simply reads input and outputs it.
Reported by Cppcheck.
caffe2/transforms/common_subexpression_elimination.cc
1 issues
Line: 44
Column: 13
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
// if they are external (isn't in parents). This is equivalent to a
// map equality (since parent edges can only contain up to one blob).
if (model_node.parents.size() != candidate_node.parents.size() ||
!std::equal(
model_node.parents.begin(),
model_node.parents.end(),
candidate_node.parents.begin())) {
return false;
}
Reported by FlawFinder.
caffe2/share/contrib/nnpack/nnpack_test.cc
1 issues
Line: 241
constexpr size_t kIters = 20;
TEST(NNPACK, Conv_3x3s1) {
for (int i = 0; i < kIters; ++i) {
runConv(3, 3, 1, 1);
}
}
Reported by Cppcheck.
caffe2/python/operator_test/fused_nbit_rowwise_test.cc
1 issues
Line: 35
}
}
TEST(OperatorSchemaTest, TensorInferenceNbitHalf) {
for (int bit_rate : {2, 4}) {
const OpSchema* schema = OpSchemaRegistry::Schema(
"HalfToFused" + std::to_string(bit_rate) + "BitRowwiseQuantized");
EXPECT_TRUE(schema != nullptr);
Reported by Cppcheck.
caffe2/share/contrib/nnpack/conv_op.cc
1 issues
Line: 400
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
"NNPACK convolution computation returned error");
if (FLAGS_caffe2_profile_nnpack) {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,cppcoreguidelines-avoid-magic-numbers,modernize-avoid-c-arrays)
char buffer[1024];
const double gmacs =
double(
// NOLINTNEXTLINE(bugprone-integer-division)
Y->dim32(2) * Y->dim32(3) * Y->dim32(1) * X.dim32(1) *
kernel_size.width * kernel_size.height / group_ / group_) /
Reported by FlawFinder.