mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Phillip Lougher <phillip@lougher.demon.co.uk>
Cc: akpm@linux-foundation.org, Geert.Uytterhoeven@sonycom.com,
	linux-kernel@vger.kernel.org, s.L-H@gmx.de
Subject: Re: [GIT-PULL] More Squashfs fixes for 2.6.29?
Date: Wed, 11 Mar 2009 17:39:26 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0903111715340.32478@localhost.localdomain> (raw)
In-Reply-To: <49B85335.2010504@lougher.demon.co.uk>



On Thu, 12 Mar 2009, Phillip Lougher wrote:
> 
> But I optimised the inner loop out because of the following logic:
> 
> zlib_inflate always tries to make as much progress as possible

Is this strictly true? Your own bug report seems to say that it isn't.

Hmm. [ Goes back and looks. ] The zlib source code is a total piece of 
mess, but it does seem like it only does "goto inf_leave" when it needs 
more data (unless you ask for the "stop at block boundary", of course). Or 
in the Z_STREAM_END case, or errors. 

But your bug report sounds very much like you got all the data already 
(nothing available for output any more), but then didn't do the last CHECK 
stage (== no output, but the input contains the 32-bit adler checksum and 
the CHECK command). That would explain exactly the case of "a few extra 
bytes at the input, despite not having any output left".

And if you don't do the CHECK stage, then you're missing a large part of 
the corruption checking that zlib does.

So you should never exit based on whether you still need output. So that

	if (msblk->stream.avail_out == 0) {
		..
		else if (msblk->stream.avail_in > 0
			BUG

really looks _wrong_. It's not a buggy situation at all to have no output 
left to process, but still input in the input buffers. It may well just 
mean that you ended up having the CHECK part of the zlib buffer in a new 
input buffer.

		Linus

  reply	other threads:[~2009-03-12  0:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 19:25 Phillip Lougher
2009-03-11 19:50 ` Linus Torvalds
2009-03-12  0:11   ` Phillip Lougher
2009-03-12  0:39     ` Linus Torvalds [this message]
2009-03-12  0:59       ` Phillip Lougher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0903111715340.32478@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillip@lougher.demon.co.uk \
    --cc=s.L-H@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®