Skip to contentSkip to conversation

lib: update LZ4 compressor module

bug report Dan Carpenter 2 participants 4 messages Jan 31, 2017 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Sven Schmidt,

This is a semi-automatic email about new static checker warnings.

The patch e355e356f87b: "lib: update LZ4 compressor module" from Jan 25, 2017, leads to the following Smatch complaint:

lib/lz4/lz4_compress.c:890 lz4_compress()
warn: variable dereferenced before check 'dst_len' (see line 880)

lib/lz4/lz4_compress.c
879 size_t *dst_len, void *wrkmem) {
880 *dst_len = LZ4_compress_default(src, dst, (int)src_len,

                 ^^^^^^^

Dereference.

881 (int)((size_t)dst_len), wrkmem);
882
883 /*
884 * Prior lz4_compress will return -1 in case of error
885 * and 0 on success
886 * while new LZ4_compress_fast/default
887 * returns 0 in case of error
888 * and the output length on success
889 */
890 if (!dst_len)

                     ^^^^^^^

Checked too late. Can this test just be deleted?

891 return -1;
892 else

regards,
dan carpenter

#1 lore raw

Same thing for lz4hc_compress() as well.

lib/lz4/lz4hc_compress.c:622 lz4hc_compress()
warn: variable dereferenced before check 'dst_len' (see line 612)

regards,
dan carpenter

#2 lore raw
In reply to Dan Carpenter

Am 31. Januar 2017 11:43:28 MEZ schrieb Dan Carpenter <[email protected]>:

Quoted 7 lines

Same thing for lz4hc_compress() as well.

lib/lz4/lz4hc_compress.c:622 lz4hc_compress()
warn: variable dereferenced before check 'dst_len' (see line 612)

regards,
dan carpenter

Hi Dan,

I did not receive any previous E-Mails, so this one is a bit out of context for me. I checked the kernel-janitors archive though and found the E-Mail you may reference to.

I will fix it.

Is there a way to automatically receive any following messages?

Thanks,

Sven

#3 lore raw
In reply to Dan Carpenter
Quoted 9 lines · On Tue, Jan 31, 2017 at 01:09:23PM +0100, Sven Schmidt (4sschmid) wrote:

Am 31. Januar 2017 11:43:28 MEZ schrieb Dan Carpenter <[email protected]>:

Quoted 7 lines

Same thing for lz4hc_compress() as well.

lib/lz4/lz4hc_compress.c:622 lz4hc_compress()
warn: variable dereferenced before check 'dst_len' (see line 612)

regards,
dan carpenter

Quoted 8 lines

Hi Dan,

I did not receive any previous E-Mails, so this one is a bit out of context for me. I checked the kernel-janitors archive though and found the E-Mail you may reference to.

I will fix it.

Is there a way to automatically receive any following messages?

It's a Smatch warning.

regards,
dan carpenter