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

[PATCH v3 6/8] gzip: move output buffer into gunzip state


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 24 Apr 2024 12:34:20 -0400
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713976481; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=WfcMj3qazSdzkU6dFM26hg04wmGK/gWTZz4wD/ytpcY=; b=AJX/SJcXOCzkBTso6hSAlOLe4oLja+dCaw4zNNpYuSgMHK206t5dMD96V9yinphBBC8x+YEV0DaSz5WyDLI8LO4+DvJCg/soHINLgTZ8YgB4bQw6Ugwtsj80oyqGOPsFmb60cLahZE7HrHBK5tmM2R10ofXLSnVaumk3UhY0I3w=
  • Arc-seal: i=1; a=rsa-sha256; t=1713976481; cv=none; d=zohomail.com; s=zohoarc; b=dxilOEIuuqYyyic74PF4BudElh/dyY/OViM75l9ofaXLnmaRhs05MsbZgRAGVJTMAmwFsWBal8t4mSyrJnpbMEExq3wOCIDNQGwkGIOUsoSdI4gBUJ2Xc04bQ+poByHI4bgoX2cb6Fim7ICWg2BoD2d3JYHhZU8eG82ThfeG1uQ=
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivered-to: dpsmith@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 24 Apr 2024 16:36:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/common/gzip/gunzip.c  | 7 ++++---
 xen/common/gzip/inflate.c | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/common/gzip/gunzip.c b/xen/common/gzip/gunzip.c
index 3fb9589b069e..95d924d36726 100644
--- a/xen/common/gzip/gunzip.c
+++ b/xen/common/gzip/gunzip.c
@@ -15,6 +15,8 @@ struct gunzip_state {
     size_t insize;
     /* Index of next byte to be processed in inbuf: */
     unsigned int inptr;
+
+    unsigned long bytes_out;
 };
 
 #define malloc(a)       xmalloc_bytes(a)
@@ -42,7 +44,6 @@ typedef unsigned long   ulg;
 #  define Tracecv(c, x)
 #endif
 
-static long __initdata bytes_out;
 static void flush_window(struct gunzip_state *s);
 
 static __init void error(const char *x)
@@ -80,7 +81,7 @@ static __init void flush_window(struct gunzip_state *s)
     }
     crc = c;
 
-    bytes_out += (unsigned long)s->wp;
+    s->bytes_out += (unsigned long)s->wp;
     s->wp = 0;
 }
 
@@ -113,7 +114,7 @@ __init int perform_gunzip(char *output, char *image, 
unsigned long image_len)
     s->inbuf = (unsigned char *)image;
     s->insize = image_len;
     s->inptr = 0;
-    bytes_out = 0;
+    s->bytes_out = 0;
 
     makecrc();
 
diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c
index f1a3b04cef8f..bec8801df487 100644
--- a/xen/common/gzip/inflate.c
+++ b/xen/common/gzip/inflate.c
@@ -1196,7 +1196,7 @@ static int __init gunzip(struct gunzip_state *s)
         error("crc error");
         return -1;
     }
-    if (orig_len != bytes_out) {
+    if (orig_len != s->bytes_out) {
         error("length error");
         return -1;
     }
-- 
2.30.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.