From 730d4a6cee747e51a849bb49f8c30ec235dbb471 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 19 Apr 2021 12:05:07 +0200 Subject: [PATCH] Fix dvision by zero check in percent() --- src/crypto/common/HugePagesInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/common/HugePagesInfo.h b/src/crypto/common/HugePagesInfo.h index 295817e34..869354e47 100644 --- a/src/crypto/common/HugePagesInfo.h +++ b/src/crypto/common/HugePagesInfo.h @@ -41,7 +41,7 @@ public: size_t size = 0; inline bool isFullyAllocated() const { return allocated == total; } - inline double percent() const { return allocated == 0 ? 0.0 : static_cast(allocated) / total * 100.0; } + inline double percent() const { return total == 0 ? 0.0 : static_cast(allocated) / total * 100.0; } inline void reset() { allocated = 0; total = 0; size = 0; } inline HugePagesInfo &operator+=(const HugePagesInfo &other)