]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: zstd - fix duplicate check warning
authorSuman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Mon, 30 Jun 2025 09:24:18 +0000 (10:24 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 10 Jul 2025 08:15:41 +0000 (20:15 +1200)
Fix the following warnings reported by the static analyzer Smatch:
    crypto/zstd.c:273 zstd_decompress()
    warn: duplicate check 'scur' (previous on line 235)

Fixes: f5ad93ffb541 ("crypto: zstd - convert to acomp")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-crypto/92929e50-5650-40be-8c0a-de81e77f0acf@sabinyo.mountain/
Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/zstd.c

index 657e0cf7b952420785cc5ddf90cc475e014a3192..24edb4d616b56d040c804e9ce57f0ab7d3adbcb9 100644 (file)
@@ -268,10 +268,9 @@ static int zstd_decompress(struct acomp_req *req)
                        total_out += outbuf.pos;
 
                        acomp_walk_done_dst(&walk, outbuf.pos);
-               } while (scur != inbuf.pos);
+               } while (inbuf.pos != scur);
 
-               if (scur)
-                       acomp_walk_done_src(&walk, scur);
+               acomp_walk_done_src(&walk, scur);
        } while (ret == 0);
 
 out: