From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Sun, 26 Jul 2020 13:15:30 -0400 Subject: Reproducibility regression with mx6cuboxi In-Reply-To: References: <874kq3xt2u.fsf@ponder> <0f740a9d-4095-d53a-1597-2413c65517aa@gmx.de> <20200722184459.GS6227@bill-the-cat> <20200722211010.GT6227@bill-the-cat> <20200726150513.GE5204@bill-the-cat> Message-ID: <20200726171530.GA6965@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Jul 26, 2020 at 02:00:33PM -0300, Fabio Estevam wrote: > On Sun, Jul 26, 2020 at 12:05 PM Tom Rini 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? I mean just literally changing the malloc(...) to calloc(1, ...), audit any other malloc(...) calls in the file and change nothing else. Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: