mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
3689456b4b
Fix potential use of uninitialised variable caused by recent decompressor code optimisations. In zlib_uncompress (zlib_wrapper.c) we have int zlib_err, zlib_init = 0; ... do { ... if (avail == 0) { offset = 0; put_bh(bh[k++]); continue; } ... zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); ... } while (zlib_err == Z_OK); If continue is executed (avail == 0) then the while condition will be evaluated testing zlib_err, which is uninitialised first time around the loop. Fix this by getting rid of the 'if (avail == 0)' condition test, this edge condition should not be being handled in the decompressor code, and instead handle it generically in the caller code. Similarly for xz_wrapper.c. Incidentally, on most architectures (bar Mips and Parisc), no uninitialised variable warning is generated by gcc, this is because the while condition test on continue is optimised out and not performed (when executing continue zlib_err has not been changed since entering the loop, and logically if the while condition was true previously, then it's still true). Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk> Reported-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
||
---|---|---|
.. | ||
block.c | ||
cache.c | ||
decompressor.c | ||
decompressor.h | ||
dir.c | ||
export.c | ||
file.c | ||
fragment.c | ||
id.c | ||
inode.c | ||
Kconfig | ||
lzo_wrapper.c | ||
Makefile | ||
namei.c | ||
squashfs_fs_i.h | ||
squashfs_fs_sb.h | ||
squashfs_fs.h | ||
squashfs.h | ||
super.c | ||
symlink.c | ||
xattr_id.c | ||
xattr.c | ||
xattr.h | ||
xz_wrapper.c | ||
zlib_wrapper.c |