All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>
Cc: Lasse Collin <lasse.collin@tukaani.org>,
	Chao Yu <chao@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 3/7] lib/xz: Move s->lzma.len = 0 initialization to lzma_reset()
Date: Mon, 11 Oct 2021 05:31:41 +0800	[thread overview]
Message-ID: <20211010213145.17462-4-xiang@kernel.org> (raw)
In-Reply-To: <20211010213145.17462-1-xiang@kernel.org>

From: Lasse Collin <lasse.collin@tukaani.org>

It's a more logical place even if the resetting needs to be done
only once per LZMA2 stream (if lzma_reset() called in the middle
of an LZMA2 stream, .len will already be 0).

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 lib/xz/xz_dec_lzma2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index d548cf0e59fe..22b789645ce5 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -791,6 +791,7 @@ static void lzma_reset(struct xz_dec_lzma2 *s)
 	s->lzma.rep1 = 0;
 	s->lzma.rep2 = 0;
 	s->lzma.rep3 = 0;
+	s->lzma.len = 0;
 
 	/*
 	 * All probabilities are initialized to the same value. This hack
@@ -1174,8 +1175,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
 		}
 	}
 
-	s->lzma.len = 0;
-
 	s->lzma2.sequence = SEQ_CONTROL;
 	s->lzma2.need_dict_reset = true;
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>
Cc: Lasse Collin <lasse.collin@tukaani.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Gao Xiang <hsiangkao@linux.alibaba.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3/7] lib/xz: Move s->lzma.len = 0 initialization to lzma_reset()
Date: Mon, 11 Oct 2021 05:31:41 +0800	[thread overview]
Message-ID: <20211010213145.17462-4-xiang@kernel.org> (raw)
In-Reply-To: <20211010213145.17462-1-xiang@kernel.org>

From: Lasse Collin <lasse.collin@tukaani.org>

It's a more logical place even if the resetting needs to be done
only once per LZMA2 stream (if lzma_reset() called in the middle
of an LZMA2 stream, .len will already be 0).

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 lib/xz/xz_dec_lzma2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index d548cf0e59fe..22b789645ce5 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -791,6 +791,7 @@ static void lzma_reset(struct xz_dec_lzma2 *s)
 	s->lzma.rep1 = 0;
 	s->lzma.rep2 = 0;
 	s->lzma.rep3 = 0;
+	s->lzma.len = 0;
 
 	/*
 	 * All probabilities are initialized to the same value. This hack
@@ -1174,8 +1175,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
 		}
 	}
 
-	s->lzma.len = 0;
-
 	s->lzma2.sequence = SEQ_CONTROL;
 	s->lzma2.need_dict_reset = true;
 
-- 
2.20.1


  parent reply	other threads:[~2021-10-10 21:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-10 21:31 [PATCH 0/7] erofs: add LZMA compression support Gao Xiang
2021-10-10 21:31 ` Gao Xiang
2021-10-10 21:31 ` [PATCH 1/7] lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompression Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-10 21:31 ` [PATCH 2/7] lib/xz: Validate the value before assigning it to an enum variable Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-10 21:31 ` Gao Xiang [this message]
2021-10-10 21:31   ` [PATCH 3/7] lib/xz: Move s->lzma.len = 0 initialization to lzma_reset() Gao Xiang
2021-10-10 21:31 ` [PATCH 4/7] lib/xz: Add MicroLZMA decoder Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-10 21:31 ` [PATCH 5/7] lib/xz, lib/decompress_unxz.c: Fix spelling in comments Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-10 21:31 ` [PATCH 6/7] erofs: rename some generic methods in decompressor Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-19 13:03   ` Chao Yu
2021-10-19 13:03     ` Chao Yu
2021-10-10 21:31 ` [PATCH 7/7] erofs: lzma compression support Gao Xiang
2021-10-10 21:31   ` Gao Xiang
2021-10-19 13:04   ` Chao Yu
2021-10-19 13:04     ` Chao Yu
2021-10-14  1:45 ` [PATCH 0/7] erofs: add LZMA " Gao Xiang
2021-10-14  1:45   ` Gao Xiang

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=20211010213145.17462-4-xiang@kernel.org \
    --to=xiang@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chao@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=lasse.collin@tukaani.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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.