From 8b71c1553e8fc88861ec0b728d6ea4e96dfcc8cb Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Wed, 9 Nov 2016 15:39:37 -0700 Subject: [PATCH] Fix invalid Coverity error This should make a Coverity error go away. The error is being generated in error by Coverity, but it isn't smart enough to determine the range of values possible from a modulo function (if the input is negative, its results can't be less than the negative of the divisor). This should clear about a dozen errors. --- src/common/read_config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/read_config.c b/src/common/read_config.c index 28e57ef0904..4b266ffd11d 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -1558,6 +1558,8 @@ static int _get_hash_idx(const char *name) index %= NAME_HASH_LEN; if (index < 0) index += NAME_HASH_LEN; + if (index < 0) + index = 0 /* Can never happen, but clears a Coverity error */ return index; } -- GitLab