* [PATCH 2/2] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations.
@ 2019-11-08 20:00 Daniel Walker
2019-11-08 20:27 ` Daniel Walker
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Walker @ 2019-11-08 20:00 UTC (permalink / raw)
To: Andrew Morton
Cc: Lasse Collin, Yu Sun, xe-linux-external, Daniel Walker,
linux-kernel
From: Lasse Collin <lasse.collin@tukaani.org>
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.
For the original commit to xz-embedded.git, please refer to:
https://git.tukaani.org/?p=xz-embedded.git;a=commit;h=40d291b
Signed-off-by: Yu Sun <yusun2@cisco.com>
Cc: xe-linux-external@cisco.com
Signed-off-by: Daniel Walker <dwalker@fifo99.com>
---
lib/xz/xz_dec_lzma2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index 08c3c8049998..156f26fdc4c9 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -1146,6 +1146,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
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) {
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations.
2019-11-08 20:00 [PATCH 2/2] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations Daniel Walker
@ 2019-11-08 20:27 ` Daniel Walker
2019-11-08 20:50 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Walker @ 2019-11-08 20:27 UTC (permalink / raw)
To: Andrew Morton
Cc: Lasse Collin, Yu Sun, xe-linux-external, Daniel Walker,
linux-kernel
On Fri, Nov 08, 2019 at 12:00:40PM -0800, Daniel Walker wrote:
> From: Lasse Collin <lasse.collin@tukaani.org>
>
> 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.
>
> For the original commit to xz-embedded.git, please refer to:
> https://git.tukaani.org/?p=xz-embedded.git;a=commit;h=40d291b
>
> Signed-off-by: Yu Sun <yusun2@cisco.com>
Yu made me aware that Lasse had sent this on Nov. 4. I would recommend you
take that patch, and disregard this one. Cisco is using it and we would like
to see it merged.
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations.
2019-11-08 20:27 ` Daniel Walker
@ 2019-11-08 20:50 ` Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2019-11-08 20:50 UTC (permalink / raw)
To: Daniel Walker
Cc: Lasse Collin, Yu Sun, xe-linux-external, Daniel Walker,
linux-kernel
On Fri, 8 Nov 2019 12:27:54 -0800 Daniel Walker <danielwa@cisco.com> wrote:
> On Fri, Nov 08, 2019 at 12:00:40PM -0800, Daniel Walker wrote:
> > From: Lasse Collin <lasse.collin@tukaani.org>
> >
> > 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.
> >
> > For the original commit to xz-embedded.git, please refer to:
> > https://git.tukaani.org/?p=xz-embedded.git;a=commit;h=40d291b
> >
> > Signed-off-by: Yu Sun <yusun2@cisco.com>
>
>
> Yu made me aware that Lasse had sent this on Nov. 4. I would recommend you
> take that patch, and disregard this one. Cisco is using it and we would like
> to see it merged.
No probs. I'll take that as an acked-by ;)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-08 20:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 20:00 [PATCH 2/2] lib/xz: Fix XZ_DYNALLOC to avoid useless memory reallocations Daniel Walker
2019-11-08 20:27 ` Daniel Walker
2019-11-08 20:50 ` Andrew Morton
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.