Skip to contentSkip to conversation

zlib: allow 0 as destination pointer

PATCH New Alessandro Rubini 3 participants 3 messages Jul 29, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 zlib: allow 0 as destination pointer

Quoted 2 lines

Hi rhabarber1848,
please could you test latest two zlib patches I have sent few minutes ago?

Unfortunately you add outcb() only in inflatestart and inflateend. IT should also go in the main loop.

Being an out-callback with arguments, it should be called during copy to output, with proper arguments (and in that form it would be a fix to the official zlib).

I tried this one, which is a quick hack (no arguments passed, so not suitable for upstream zlib in any case). Moreover, one of those two should be sufficient, but I don't know which one exactly. I'm lazy so I won't trace program flow in detail.

I think rhabarber should test with this addition too and select which one is the good one.

(formatted for git-am for quick testing, even thought he talk is irrelevant as a commit message).

ps: please note that your addition of outcb() has white-space inconsistency with zlib.c (which is not u-boot style while those lines are).

/alessandro

---
 lib_generic/zlib.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
lib_generic/zlib.c +6 -0
index 6a78dc9..66b18eb 100644
@@ -1129,6 +1129,10 @@ unsigned out;
 
     state = (struct inflate_state FAR *)strm->state;
 
+    /* call watchdog_reset if needed (addition for U-Boot) */
+    if (strm->outcb != Z_NULL)
+        (*strm->outcb)(Z_NULL, 0);
+
     /* if it hasn't been done already, allocate space for the window */
     if (state->window == Z_NULL) {
         state->window = (unsigned char FAR *)
@@ -1741,6 +1745,8 @@ int flush;
             Tracev((stderr, "inflate:       codes ok\n"));
             state->mode = LEN;
         case LEN:
+            if (strm->outcb != Z_NULL) /* for watchdog (U-Boot) */
+                (*strm->outcb)(Z_NULL, 0);
             if (have >= 6 && left >= 258) {
                 RESTORE();
                 inflate_fast(strm, out);
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 1/1 zlib: allow 0 as destination pointer

Hi,

Quoted 7 lines · Alessandro Rubini
Quoted 3 lines · Giuseppe Condorelli

Hi rhabarber1848,
please could you test latest two zlib patches I have sent few minutes ago?

Unfortunately you add outcb() only in inflatestart and inflateend. IT should also go in the main loop.

you are right. The two patches sent by Giuseppe do not solve the problem.

Quoted 2 lines

I think rhabarber should test with this addition too and select which one is the good one.

Let's see:

lib_generic/zlib.c unsigned out; · line 1138

Quoted 13 lines
lib_generic/zlib.c +4 -0
@@ -1129,6 +1129,10 @@ unsigned out;
 
     state = (struct inflate_state FAR *)strm->state;
 
+    /* call watchdog_reset if needed (addition for U-Boot) */
+    if (strm->outcb != Z_NULL)
+        (*strm->outcb)(Z_NULL, 0);
+
     /* if it hasn't been done already, allocate space for the window */
     if (state->window == Z_NULL) {
         state->window = (unsigned char FAR *)

This patch does not fix the problem.

lib_generic/zlib.c int flush; · line 1752

Quoted 9 lines
lib_generic/zlib.c +2 -0
@@ -1741,6 +1745,8 @@ int flush;
             Tracev((stderr, "inflate:       codes ok\n"));
             state->mode = LEN;
         case LEN:
+            if (strm->outcb != Z_NULL) /* for watchdog (U-Boot) */
+                (*strm->outcb)(Z_NULL, 0);
             if (have >= 6 && left >= 258) {
                 RESTORE();
                 inflate_fast(strm, out);

This patch alone seems to solve the problem, only with it U-Boot could decompress a Linux image, proven with 10 successful boot attempts. All the other patches regarding WATCHDOG_RESET() can be ignored.

Tested with U-Boot 2008.09-rc1, the original zlib123-patch from Giuseppe + your "allow 0 as destination pointer"-patch and the last patch from the mail quoted above.

Cheers, rhabarber1848

#3 lore raw

PATCH 1/1 zlib: allow 0 as destination pointer

Hi rhbarber1848,

I've merged patches into one only and resent it to list (v5). Please verify once more the issue is solved, to close it definitively.

Cheers and thanks,
Giuseppe

-----Original Message-----
From: [email protected] [mailto:u-boot-bounces at lists.denx.de] On Behalf Of rhabarber1848
Sent: Wednesday, July 29, 2009 12:33 PM
To: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] zlib: allow 0 as destination pointer

Hi,

Quoted 7 lines · Alessandro Rubini
Quoted 3 lines · Giuseppe Condorelli

Hi rhabarber1848,
please could you test latest two zlib patches I have sent few minutes ago?

Unfortunately you add outcb() only in inflatestart and inflateend. IT should also go in the main loop.

you are right. The two patches sent by Giuseppe do not solve the problem.

Quoted 2 lines

I think rhabarber should test with this addition too and select which one is the good one.

Let's see:

lib_generic/zlib.c unsigned out; · line 1138

Quoted 13 lines
lib_generic/zlib.c +4 -0
@@ -1129,6 +1129,10 @@ unsigned out;
 
     state = (struct inflate_state FAR *)strm->state;
 
+    /* call watchdog_reset if needed (addition for U-Boot) */
+    if (strm->outcb != Z_NULL)
+        (*strm->outcb)(Z_NULL, 0);
+
     /* if it hasn't been done already, allocate space for the window */
     if (state->window == Z_NULL) {
         state->window = (unsigned char FAR *)

This patch does not fix the problem.

lib_generic/zlib.c int flush; · line 1752

Quoted 9 lines
lib_generic/zlib.c +2 -0
@@ -1741,6 +1745,8 @@ int flush;
             Tracev((stderr, "inflate:       codes ok\n"));
             state->mode = LEN;
         case LEN:
+            if (strm->outcb != Z_NULL) /* for watchdog (U-Boot) */
+                (*strm->outcb)(Z_NULL, 0);
             if (have >= 6 && left >= 258) {
                 RESTORE();
                 inflate_fast(strm, out);

This patch alone seems to solve the problem, only with it U-Boot could decompress a Linux image, proven with 10 successful boot attempts. All the other patches regarding WATCHDOG_RESET() can be ignored.

Tested with U-Boot 2008.09-rc1, the original zlib123-patch from Giuseppe + your "allow 0 as destination pointer"-patch and the last patch from the mail quoted above.

Cheers, rhabarber1848

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot