From: akpm@linux-foundation.org
To: akpm@linux-foundation.org, danielwa@cisco.com,
lasse.collin@tukaani.org, linux-mm@kvack.org,
mm-commits@vger.kernel.org, torvalds@linux-foundation.org,
yisi@cisco.com, yusun2@cisco.com
Subject: [patch 03/11] lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
Date: Fri, 15 Nov 2019 17:34:39 -0800 [thread overview]
Message-ID: <20191116013439.KBuh9ZTdq%akpm@linux-foundation.org> (raw)
From: Lasse Collin <lasse.collin@tukaani.org>
Subject: lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
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.
Link: http://lkml.kernel.org/r/20191104185107.3b6330df@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Reported-by: Yu Sun <yusun2@cisco.com>
Acked-by: Daniel Walker <danielwa@cisco.com>
Cc: "Yixia Si (yisi)" <yisi@cisco.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/xz/xz_dec_lzma2.c | 1 +
1 file changed, 1 insertion(+)
--- a/lib/xz/xz_dec_lzma2.c~lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations
+++ a/lib/xz/xz_dec_lzma2.c
@@ -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;
vfree(s->dict.buf);
s->dict.buf = vmalloc(s->dict.size);
if (s->dict.buf == NULL) {
_
reply other threads:[~2019-11-16 1:34 UTC|newest]
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:
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=20191116013439.KBuh9ZTdq%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=danielwa@cisco.com \
--cc=lasse.collin@tukaani.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yisi@cisco.com \
--cc=yusun2@cisco.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