[U-Boot] [PATCH] zlib: allow 0 as destination pointer

rhabarber1848 rhabarber1848 at web.de
Wed Jul 29 12:32:38 CEST 2009


Hi,

Alessandro Rubini wrote:
> Giuseppe Condorelli wrote:
>> 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.

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

Let's see:

> --- a/lib_generic/zlib.c
> +++ b/lib_generic/zlib.c
> @@ -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.

> @@ -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




More information about the U-Boot mailing list