From: Nigel Cunningham <ncunningham@cyclades.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix cryptoapi deflate not handling PAGE_SIZE chunks.
Date: Sun, 31 Jul 2005 15:14:02 +1000 [thread overview]
Message-ID: <1122786842.4351.8.camel@localhost> (raw)
In-Reply-To: <20050731034010.GA5564@gondor.apana.org.au>
Hi.
On Sun, 2005-07-31 at 13:40, Herbert Xu wrote:
> On Mon, Jul 18, 2005 at 01:26:35PM +1000, Nigel Cunningham wrote:
> >
> > Here's a resend of a patch I'm using in Suspend2's new cryptoapi
> > support, which is needed for us to successfully compress pages using
> > deflate. It's along the lines of the existing fix in the decompression
> > code.
> >
> > diff -ruNp 190-cryptoapi-deflate.patch-old/crypto/deflate.c 190-cryptoapi-deflate.patch-new/crypto/deflate.c
> > --- 190-cryptoapi-deflate.patch-old/crypto/deflate.c 2005-06-20 11:46:49.000000000 +1000
> > +++ 190-cryptoapi-deflate.patch-new/crypto/deflate.c 2005-07-04 23:14:20.000000000 +1000
> > @@ -143,8 +143,15 @@ static int deflate_compress(void *ctx, c
> >
> > ret = zlib_deflate(stream, Z_FINISH);
> > if (ret != Z_STREAM_END) {
> > - ret = -EINVAL;
> > - goto out;
> > + if (!(ret == Z_OK && !stream->avail_in && !stream->avail_out)) {
> > + ret = -EINVAL;
> > + goto out;
> > + } else {
> > + u8 zerostuff = 0;
> > + stream->next_out = &zerostuff;
> > + stream->avail_out = 1;
> > + ret = zlib_deflate(stream, Z_FINISH);
> > + }
> > }
> > ret = 0;
> > *dlen = stream->total_out;
>
> Hi Nigel, I need a bit more information about this patch.
> Do you have a specific input stream that requires a fix like
> this?
Yes, Suspend2 if the user selects deflate as their compressor. The
output data will be PAGE_SIZE chunks, but deflate sometimes thinks it
has an extra byte to give us back.
I agree that it's ugly and don't recall using it when I had gzip support
in an earlier version of Suspend2. Are you thinking there might be a
better way? If so, I can dig out the old (non crypto api) code.
Regards,
Nigel
--
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.
next prev parent reply other threads:[~2005-07-31 5:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-18 3:26 [PATCH] Fix cryptoapi deflate not handling PAGE_SIZE chunks Nigel Cunningham
2005-07-31 3:40 ` Herbert Xu
2005-07-31 5:14 ` Nigel Cunningham [this message]
2005-07-31 5:49 ` Herbert Xu
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=1122786842.4351.8.camel@localhost \
--to=ncunningham@cyclades.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.