The algorithm didn't detect whether given byte_rate was zero, pointlessly iterating through data units. Make it exit early in this case. Signed-off-by: Phil Sutter <phil@xxxxxx> --- src/statement.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/statement.c b/src/statement.c index f81e0123adda0..fccf71c10b1d4 100644 --- a/src/statement.c +++ b/src/statement.c @@ -313,6 +313,11 @@ const char *get_rate(uint64_t byte_rate, uint64_t *rate) { int i; + if (!byte_rate) { + *rate = 0; + return data_unit[0]; + } + for (i = 0; data_unit[i + 1] != NULL; i++) { if (byte_rate % 1024) break; -- 2.16.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html