From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 2/2] [Suspend2] Make cryptoapi deflate module handle full pages.
Date: Tue, 27 Jun 2006 02:51:42 +1000 [thread overview]
Message-ID: <20060626165141.10864.27861.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626165135.10864.53686.stgit@nigel.suspend2.net>
The cryptoapi deflate module currently returns an error when it
successfully handles a full page of data at the end of a compressed stream.
This patch addresses that behaviour.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
crypto/deflate.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/crypto/deflate.c b/crypto/deflate.c
index f209368..2a38593 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -142,8 +142,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;
--
Nigel Cunningham nigel at suspend2 dot net
next prev parent reply other threads:[~2006-06-26 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-26 16:51 [Suspend2][ 0/2] Cryptoapi deflate fix Nigel Cunningham
2006-06-26 16:51 ` [Suspend2][ 1/2] [Suspend2] Add cryptoapi LZF support Nigel Cunningham
2006-06-26 16:51 ` Nigel Cunningham [this message]
2006-06-26 20:09 ` [Suspend2][ 0/2] Cryptoapi deflate fix Rafael J. Wysocki
2006-06-26 22:52 ` Nigel Cunningham
2006-06-27 6:00 ` Herbert Xu
2006-06-27 7:02 ` Nigel Cunningham
2006-06-27 9:35 ` 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=20060626165141.10864.27861.stgit@nigel.suspend2.net \
--to=nigel@suspend2.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox