]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libradosstriper: do not assign garbage to returned value 15009/head
authorKefu Chai <kchai@redhat.com>
Tue, 9 May 2017 04:56:59 +0000 (12:56 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 10 May 2017 02:31:57 +0000 (10:31 +0800)
if `rc` is not zero, the returned `ssize` is either garbage or
undefined. this silences warning from clang analyzer:

Assigned value is garbage or undefined

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/libradosstriper/RadosStriperImpl.cc

index ea3be3b145c69da0ca212c6925f8810e382593bf..47c36fd3aa62cb8a2876f40fe256575b73bd8569 100644 (file)
@@ -1169,10 +1169,13 @@ int libradosstriper::RadosStriperImpl::internal_get_layout_and_size(
   // deal with size
   size_t ssize;
   rc = extract_sizet_attr(attrs, XATTR_SIZE, &ssize);
+  if (rc) {
+    return rc;
+  }
   *size = ssize;
   // make valgrind happy by setting unused fl_pg_pool
   layout->fl_pg_pool = 0;
-  return rc;
+  return 0;
 }
 
 int libradosstriper::RadosStriperImpl::openStripedObjectForRead(