From 2c899fbe5787c7cb48445944be95d8cefdc857f3 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Fri, 14 Jul 2017 07:43:51 +0530 Subject: [PATCH] crush: silence warning from -Woverflow MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The following warning appears during build: ceph/src/crush/CrushWrapper.cc: In member function ‘int32_t CrushWrapper::_alloc_class_id() const’: ceph/src/crush/CrushWrapper.cc:1322:56: warning: integer overflow in expression [-Woverflow] uint32_t upperlimit = numeric_limits::max() + 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ Signed-off-by: Jos Collin --- src/crush/CrushWrapper.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 3bdc7d73c31e2..fdcace16d0b28 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1319,7 +1319,8 @@ int32_t CrushWrapper::_alloc_class_id() const { return class_id; } // wrapped, pick a random start and do exhaustive search - uint32_t upperlimit = numeric_limits::max() + 1; + uint32_t upperlimit = numeric_limits::max(); + upperlimit++; class_id = rand() % upperlimit; const auto start = class_id; do { -- 2.39.5