+ lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
has been added to the -mm tree.  Its filename is
     lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Lasse Collin <lasse.collin@xxxxxxxxxxx>
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@xxxxxxxxxxx
Signed-off-by: Lasse Collin <lasse.collin@xxxxxxxxxxx>
Reported-by: Yu Sun <yusun2@xxxxxxxxx>
Cc: "Yixia Si (yisi)" <yisi@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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) {
_

Patches currently in -mm which might be from lasse.collin@xxxxxxxxxxx are

lib-xz-fix-xz_dynalloc-to-avoid-useless-memory-reallocations.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux