Reproducibility regression with mx6cuboxi

Fabio Estevam
2020-07-26T17:00:33Z

On Sun, Jul 26, 2020 at 12:05 PM Tom Rini <trini@konsulko.com> wrote:

> We just need to use calloc() in the tool and not mess with alignment.

Like this?

--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -446,7 +446,6 @@ static int fit_extract_data(struct
image_tool_params *params, const char *fname)
int ret;
int images;
int node;
- int image_number;
int align_size;

align_size = params->bl_len ? params->bl_len : 4;
@@ -461,13 +460,12 @@ static int fit_extract_data(struct
image_tool_params *params, const char *fname)
ret = -EINVAL;
goto err_munmap;
}
- image_number = fdtdec_get_child_count(fdt, images);

/*
* Allocate space to hold the image data we will extract,
* extral space allocate for image alignment to prevent overflow.
*/
- buf = malloc(fit_size + (align_size * image_number));
+ buf = calloc(1, fit_size);
if (!buf) {
ret = -ENOMEM;
goto err_munmap;

If this is not the right approach, care to propose a patch?

Thanks