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

[xen master] xen/gunzip: Move output count into gunzip_state



commit d386a383dd6fe937cbd05ea9502f5e6059ad3036
Author:     Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
AuthorDate: Wed Apr 24 12:34:20 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu May 9 18:19:49 2024 +0100

    xen/gunzip: Move output count into gunzip_state
    
    Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/common/gzip/gunzip.c  | 7 ++++---
 xen/common/gzip/inflate.c | 4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/common/gzip/gunzip.c b/xen/common/gzip/gunzip.c
index a04ddd7445..8770430312 100644
--- a/xen/common/gzip/gunzip.c
+++ b/xen/common/gzip/gunzip.c
@@ -16,6 +16,8 @@ struct gunzip_state {
     unsigned int insize;
     /* Index of next byte to be processed in inbuf: */
     unsigned int inptr;
+
+    unsigned long bytes_out;
 };
 
 #define malloc(a)       xmalloc_bytes(a)
@@ -43,7 +45,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)
@@ -82,7 +83,7 @@ static __init void flush_window(struct gunzip_state *s)
     }
     crc = c;
 
-    bytes_out += s->wp;
+    s->bytes_out += s->wp;
     s->wp = 0;
 }
 
@@ -115,7 +116,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 62179e6ed6..2d53391e74 100644
--- a/xen/common/gzip/inflate.c
+++ b/xen/common/gzip/inflate.c
@@ -1210,7 +1210,9 @@ 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;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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