From: Gao Xiang Date: Tue, 10 Sep 2024 07:52:56 +0000 (+0800) Subject: erofs-utils: lib: use another way to check power-of-2 X-Git-Tag: v1.8.2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85ea711aafd3d1cab58ac757106536d742ec37f9;p=platform%2Fupstream%2Ferofs-utils.git 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 --- 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]));