mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Nigel Cunningham <ncunningham@cyclades.com>
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 13:40:10 +1000	[thread overview]
Message-ID: <20050731034010.GA5564@gondor.apana.org.au> (raw)
In-Reply-To: <1121657195.13487.36.camel@localhost>

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?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2005-07-31  3:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-18  3:26 Nigel Cunningham
2005-07-31  3:40 ` Herbert Xu [this message]
2005-07-31  5:14   ` Nigel Cunningham
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=20050731034010.GA5564@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@cyclades.com \
    /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®