dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/fs/squashfs
Phillip Lougher 3689456b4b squashfs: fix use of uninitialised variable in zlib & xz decompressors
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>
2011-01-26 10:50:05 +10:00
..
Kconfig Squashfs: get rid of default n in Kconfig 2011-01-13 21:21:52 +00:00
Makefile Squashfs: Add XZ compression configuration option 2011-01-13 21:16:52 +00:00
block.c squashfs: fix use of uninitialised variable in zlib & xz decompressors 2011-01-26 10:50:05 +10:00
cache.c Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
decompressor.c Squashfs: simplify CONFIG_SQUASHFS_LZO handling 2011-01-13 21:38:46 +00:00
decompressor.h Squashfs: simplify CONFIG_SQUASHFS_LZO handling 2011-01-13 21:38:46 +00:00
dir.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
export.c Squashfs: factor out remaining zlib dependencies into separate wrapper file 2010-01-20 21:47:47 +00:00
file.c Squashfs: factor out remaining zlib dependencies into separate wrapper file 2010-01-20 21:47:47 +00:00
fragment.c Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
id.c Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
inode.c squashfs: add xattr support configure option 2010-05-17 19:54:07 +01:00
lzo_wrapper.c Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
namei.c squashfs: add xattr support configure option 2010-05-17 19:54:07 +01:00
squashfs.h Squashfs: simplify CONFIG_SQUASHFS_LZO handling 2011-01-13 21:38:46 +00:00
squashfs_fs.h Squashfs: add XZ compression support 2011-01-13 20:51:20 +00:00
squashfs_fs_i.h Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
squashfs_fs_sb.h squashfs: add xattr id support 2010-05-17 19:54:05 +01:00
super.c fs: icache RCU free inodes 2011-01-07 17:50:26 +11:00
symlink.c squashfs: add xattr support configure option 2010-05-17 19:54:07 +01:00
xattr.c Squashfs: fix use of __le64 annotated variable 2010-10-28 17:44:11 +01:00
xattr.h Squashfs: fix function prototype 2010-10-28 17:44:19 +01:00
xattr_id.c Squashfs: move squashfs_i() definition from squashfs.h 2011-01-13 21:24:15 +00:00
xz_wrapper.c squashfs: fix use of uninitialised variable in zlib & xz decompressors 2011-01-26 10:50:05 +10:00
zlib_wrapper.c squashfs: fix use of uninitialised variable in zlib & xz decompressors 2011-01-26 10:50:05 +10:00