erofs-utils: lib: suppress a false-positive warning in kite-deflate
authorGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 12 Sep 2023 03:27:01 +0000 (11:27 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 12 Sep 2023 03:53:36 +0000 (11:53 +0800)
`gcc (Debian 13.2.0-2) 13.2.0` gives the following report:

kite_deflate.c: In function 'kite_deflate_writeblock':
kite_deflate.c:428:57: warning: 'distLevels' may be used uninitialized
[-Wmaybe-uninitialized]
428 |                                   fixed ? 5 :
    distLevels[distSlot]);
|                                                         ^
kite_deflate.c:393:34: note: 'distLevels' was declared here
  393 |         const u8 *litLenLevels, *distLevels;

Actually, `distLevels` won't be used in the static-huffman mode.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230912032701.8288-1-hsiangkao@linux.alibaba.com
lib/kite_deflate.c

index 91019e3871053a6bf5c680c01569c88e432f53c5..8667954162fe2943d32860242f7cf4e0974dd4fd 100644 (file)
@@ -405,6 +405,7 @@ static void kite_deflate_writeblock(struct kite_deflate *s, bool fixed)
                distCodes = kstaticHuff_distCodes;
 
                litLenLevels = kstaticHuff_litLenLevels;
+               distLevels = NULL;
        }
 
        for (i = 0; i < s->symbols; ++i) {