Re: [PATCH] unlz4: always set an error return code on failures

From: Kyungsik Lee
Date: Sun Nov 10 2013 - 21:49:38 EST


Hello Jan,

Thanks for the patch.

On Fri, Nov 08, 2013 at 09:27:09AM +0000, Jan Beulich wrote:
> "ret", being set to -1 early on, gets cleared by the first invocation
> of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
> subsequent failures wouldn't be noticed by the caller without setting
> it back to -1 right after those calls.
>
> Reported-by: Matthew Daley <mattjd@xxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Kyungsik Lee <kyungsik.lee@xxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>
> --- a/lib/decompress_unlz4.c
> +++ b/lib/decompress_unlz4.c
> @@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input,
> goto exit_2;
> }
>
> + ret = -1;
> if (flush && flush(outp, dest_len) != dest_len)
> goto exit_2;
> if (output)
>
What do you think of adding "ret2" for keeping "ret" error status
which is set by lz4_decompress*() like below.

{
int ret2;

ret2 = lz4_decompress(inp, &chunksize, outp, dest_len);
if (ret2 < 0) {

}

Thanks,
Kyungsik

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/