From 85ea711aafd3d1cab58ac757106536d742ec37f9 Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Tue, 10 Sep 2024 15:52:56 +0800 Subject: [PATCH] erofs-utils: lib: use another way to check power-of-2 Otherwise, Coverity will complain with "Operands don't affect result (CONSTANT_EXPRESSION_RESULT)", which I don't think is an issue. Coverity-id: 508261 Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20240910075256.3423180-1-hsiangkao@linux.alibaba.com --- lib/kite_deflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kite_deflate.c b/lib/kite_deflate.c index 4b1068b..592c4d1 100644 --- a/lib/kite_deflate.c +++ b/lib/kite_deflate.c @@ -834,7 +834,7 @@ static int kite_mf_init(struct kite_matchfinder *mf, unsigned int wsiz, return -EINVAL; cfg = &kite_mfcfg[level]; - if (wsiz > kHistorySize32 || (1 << ilog2(wsiz)) != wsiz) + if (wsiz > kHistorySize32 || (wsiz & (wsiz - 1))) return -EINVAL; mf->hash = calloc(0x10000, sizeof(mf->hash[0])); -- 2.34.1