LKML Archive on
 help / color / Atom feed
From: Lasse Collin <>
To: Andrew Morton <>
	"Yu Sun (yusun2)" <>,
	"Yixia Si (yisi)" <>
Subject: [PATCH] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations
Date: Mon, 4 Nov 2019 18:51:07 +0200
Message-ID: <> (raw)

From: Lasse Collin <>

s->dict.allocated was initialized to 0 but never set after a successful
allocation, thus the code always thought that the dictionary buffer has
to be reallocated.

Signed-off-by: Lasse Collin <>
Reported-by: Yu Sun <>

diff -Nrup linux-5.3-vanilla/lib/xz/xz_dec_lzma2.c linux-5.3/lib/xz/xz_dec_lzma2.c
--- linux-5.3-vanilla/lib/xz/xz_dec_lzma2.c	2019-09-16 00:19:32.000000000 +0300
+++ linux-5.3/lib/xz/xz_dec_lzma2.c	2019-10-30 20:33:15.460857851 +0200
@@ -1146,6 +1146,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset
 		if (DEC_IS_DYNALLOC(s->dict.mode)) {
 			if (s->dict.allocated < s->dict.size) {
+				s->dict.allocated = s->dict.size;
 				s->dict.buf = vmalloc(s->dict.size);
 				if (s->dict.buf == NULL) {

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone