From f5a72b75d54a5a4e7e7dd3203fb2bd5fa8c6c925 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Thu, 26 Jun 2014 10:37:36 +0200 Subject: [PATCH] Added a couple of ASSERTS for avoiding coverity to complain about the possibility of a division by 0 Signed-off-by: Sebastien Ponce --- src/test/libradosstriper/io.cc | 4 ++-- src/test/libradosstriper/striping.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/libradosstriper/io.cc b/src/test/libradosstriper/io.cc index 0850c71903b90..1386fcce45dae 100644 --- a/src/test/libradosstriper/io.cc +++ b/src/test/libradosstriper/io.cc @@ -338,7 +338,7 @@ TEST_F(StriperTest, XattrIter) { const char *name; const char *val; size_t len; - ASSERT_EQ(0, rados_getxattrs_next(iter, &name, &val, &len)); + ASSERT_EQ(0, rados_striper_getxattrs_next(iter, &name, &val, &len)); if (name == NULL) { break; } @@ -355,7 +355,7 @@ TEST_F(StriperTest, XattrIter) { ASSERT_EQ(0, 1) << "Unexpected attribute : " << name;; } } - rados_getxattrs_end(iter); + rados_striper_getxattrs_end(iter); } TEST_F(StriperTestPP, XattrListPP) { diff --git a/src/test/libradosstriper/striping.cc b/src/test/libradosstriper/striping.cc index c65f0498de585..81b458d088f2f 100644 --- a/src/test/libradosstriper/striping.cc +++ b/src/test/libradosstriper/striping.cc @@ -40,10 +40,12 @@ protected: ASSERT_LT(0, ioctx.getxattr(firstOid, "striper.layout.stripe_unit", xattrbl)); std::string s_xattr(xattrbl.c_str(), xattrbl.length()); // adds 0 byte at the end uint64_t stripe_unit = strtoll(s_xattr.c_str(), NULL, 10); + ASSERT_LT(0, stripe_unit); ASSERT_EQ(stripe_unit, exp_stripe_unit); ASSERT_LT(0, ioctx.getxattr(firstOid, "striper.layout.stripe_count", xattrbl)); s_xattr = std::string(xattrbl.c_str(), xattrbl.length()); // adds 0 byte at the end uint64_t stripe_count = strtoll(s_xattr.c_str(), NULL, 10); + ASSERT_LT(0, stripe_count); ASSERT_EQ(stripe_count, exp_stripe_count); ASSERT_LT(0, ioctx.getxattr(firstOid, "striper.layout.object_size", xattrbl)); s_xattr = std::string(xattrbl.c_str(), xattrbl.length()); // adds 0 byte at the end -- 2.47.3