Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lz4: fix compression/decompression signedness mismatch

LZ4 compression and decompression functions require different in
signedness input/output parameters: unsigned char for compression and
signed char for decompression.

Change decompression API to require "(const) unsigned char *".

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yann Collet <yann.collet.73@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Sergey Senozhatsky and committed by
Linus Torvalds
b34081f1 20b8875a

+8 -8
+4 -4
include/linux/lz4.h
··· 67 67 * note : Destination buffer must be already allocated. 68 68 * slightly faster than lz4_decompress_unknownoutputsize() 69 69 */ 70 - int lz4_decompress(const char *src, size_t *src_len, char *dest, 71 - size_t actual_dest_len); 70 + int lz4_decompress(const unsigned char *src, size_t *src_len, 71 + unsigned char *dest, size_t actual_dest_len); 72 72 73 73 /* 74 74 * lz4_decompress_unknownoutputsize() ··· 82 82 * Error if return (< 0) 83 83 * note : Destination buffer must be already allocated. 84 84 */ 85 - int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, 86 - char *dest, size_t *dest_len); 85 + int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len, 86 + unsigned char *dest, size_t *dest_len); 87 87 #endif
+4 -4
lib/lz4/lz4_decompress.c
··· 283 283 return (int) (-(((char *) ip) - source)); 284 284 } 285 285 286 - int lz4_decompress(const char *src, size_t *src_len, char *dest, 287 - size_t actual_dest_len) 286 + int lz4_decompress(const unsigned char *src, size_t *src_len, 287 + unsigned char *dest, size_t actual_dest_len) 288 288 { 289 289 int ret = -1; 290 290 int input_len = 0; ··· 302 302 EXPORT_SYMBOL(lz4_decompress); 303 303 #endif 304 304 305 - int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, 306 - char *dest, size_t *dest_len) 305 + int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len, 306 + unsigned char *dest, size_t *dest_len) 307 307 { 308 308 int ret = -1; 309 309 int out_len = 0;