]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: behave with empty weight vector 32673/head
authorKefu Chai <kchai@redhat.com>
Thu, 16 Jan 2020 07:49:58 +0000 (15:49 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 16 Jan 2020 14:14:00 +0000 (22:14 +0800)
should not dereference an empty vector.

Fixes: https://tracker.ceph.com/issues/43404
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crush/CrushWrapper.h

index 979705460384272d65b384f3714553e48614149e..8e3ceee48f664206de08a35e25770c0cdc07c7fa 100644 (file)
@@ -1577,8 +1577,9 @@ public:
     crush_init_workspace(crush, work);
     crush_choose_arg_map arg_map = choose_args_get_with_fallback(
       choose_args_index);
-    int numrep = crush_do_rule(crush, rule, x, rawout, maxout, &weight[0],
-                              weight.size(), work, arg_map.args);
+    int numrep = crush_do_rule(crush, rule, x, rawout, maxout,
+                              std::data(weight), std::size(weight),
+                              work, arg_map.args);
     if (numrep < 0)
       numrep = 0;
     out.resize(numrep);