From 31925c8857ba17c11129b766a980ff7c87780301 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Sun, 30 Jul 2006 03:03:12 -0700 Subject: [PATCH] Fix ppc32 zImage inflate The recent zlib update (commit 4f3865fb57a04db7cca068fed1c15badc064a302) broke ppc32 zImage decompression as it tries to decompress to address zero and the updated zlib_inflate checks that strm->next_out isn't a null pointer. This little patch fixes it. [rpurdie@rpsys.net: add comment] Signed-off-by: Peter Korsgaard Acked-by: Tom Rini Signed-off-by: Richard Purdie Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/zlib_inflate/inflate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/zlib_inflate') diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c index 7f922dccf1a..fceb97c3aff 100644 --- a/lib/zlib_inflate/inflate.c +++ b/lib/zlib_inflate/inflate.c @@ -347,7 +347,10 @@ int zlib_inflate(z_streamp strm, int flush) static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - if (strm == NULL || strm->state == NULL || strm->next_out == NULL || + /* Do not check for strm->next_out == NULL here as ppc zImage + inflates to strm->next_out = 0 */ + + if (strm == NULL || strm->state == NULL || (strm->next_in == NULL && strm->avail_in != 0)) return Z_STREAM_ERROR; -- cgit v1.2.3