public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: Reproducibility regression with mx6cuboxi
Date: Sun, 26 Jul 2020 13:15:30 -0400	[thread overview]
Message-ID: <20200726171530.GA6965@bill-the-cat> (raw)
In-Reply-To: <CAOMZO5D2+p0AeDsD4y+K7Cq3ortQoSkx0ZVrb4HciNJqEC-EVQ@mail.gmail.com>

On Sun, Jul 26, 2020 at 02:00:33PM -0300, Fabio Estevam wrote:
> 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?

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: <https://lists.denx.de/pipermail/u-boot/attachments/20200726/a9791d76/attachment.sig>

  reply	other threads:[~2020-07-26 17:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19 18:23 Reproducibility regression with mx6cuboxi Vagrant Cascadian
2020-07-21 22:24 ` Tom Rini
2020-07-21 22:54   ` Vagrant Cascadian
2020-07-22 18:32 ` Heinrich Schuchardt
2020-07-22 18:44   ` Tom Rini
2020-07-22 20:40     ` Fabio Estevam
2020-07-22 21:10       ` Tom Rini
2020-07-26 14:57         ` Fabio Estevam
2020-07-26 15:05           ` Tom Rini
2020-07-26 17:00             ` Fabio Estevam
2020-07-26 17:15               ` Tom Rini [this message]
2020-07-26 17:56                 ` Fabio Estevam
2020-07-26 18:17                   ` Vagrant Cascadian
2020-07-26 18:22                     ` Fabio Estevam
2020-07-28 11:23                     ` Fabio Estevam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726171530.GA6965@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox