]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter::recalc_op_target: fix uninitialized scalar variable
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 12:45:53 +0000 (13:45 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 12:45:53 +0000 (13:45 +0100)
CID 1160848 (#1 of 1): Uninitialized scalar variable (UNINIT)
 uninit_use: Using uninitialized value "best".

Init 'best' with -1 (from the code logic it will be set at least to 0)
to silence coverity.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osdc/Objecter.cc

index 7f64b00eca1da6265455df2e389c671204b69a4e..a2954662605cfb5a0f2b723d4aae3c0ae3ee09c5 100644 (file)
@@ -1495,7 +1495,7 @@ int Objecter::recalc_op_target(Op *op)
                 acting.size() > 1) {
        // look for a local replica.  prefer the primary if the
        // distance is the same.
-       int best;
+       int best = -1;
        int best_locality;
        for (unsigned i = 0; i < acting.size(); ++i) {
          int locality = osdmap->crush->get_common_ancestor_distance(