CrushWrapper::start_choose_profile allocates map->choose_tries with
choose_total_tries elements. When crush_choose_firstn sets a value, it
tests against map->choose_local_tries which could lead to memory
corruption if map->choose_total_tries is smaller than
map->choose_local_tries.
Another indesirable but non fatal side effect is that the output crushtool
--show-choose-tries will be truncated to choose_local_tries which is
set to a lower value than choose_total_tries by the default tuneables.
Signed-off-by: Loic Dachary <loic@dachary.org>
out[outpos] = item;
outpos++;
- if (map->choose_tries && ftotal <= map->choose_local_tries)
+ if (map->choose_tries && ftotal <= map->choose_total_tries)
map->choose_tries[ftotal]++;
}