[PATCH] fit_image: Use calloc() to fix reproducibility issue
authorFabio Estevam <festevam@gmail.com>
Tue, 28 Jul 2020 00:03:13 +0000 (21:03 -0300)
committerVagrant Cascadian <vagrant@debian.org>
Fri, 28 Aug 2020 23:35:40 +0000 (00:35 +0100)
commit5df39305231551e2ffb33acc9229e44b50a317d1
treebf8105d89a94fcba5b560751eda5c95539bddb44
parent3370814c37fafce512c7009b4042b0a3fc23a2a5
[PATCH] fit_image: Use calloc() to fix reproducibility issue

From 7a66514f64dfb302dd9e763278d2d8a86b94a050 Mon Sep 17 00:00:00 2001
Origin: https://patchwork.ozlabs.org/project/uboot/patch/20200728000313.31130-1-festevam@gmail.com/

Vagrant Cascadian reported that mx6cuboxi target no longer builds
reproducibility on Debian.

One example of builds mismatches:

00096680: 696e 6700 736f 756e 642d 6461 6900 6465  ing.sound-dai.de
-00096690: 7465 6374 2d67 7069 6f73 0000            tect-gpios..
+00096690: 7465 6374 2d67 7069 6f73 0061            tect-gpios.a

This problem happens because all the buffers in fit_image.c are
allocated via malloc(), which does not zero out the allocated buffer.

Using calloc() fixes this unpredictable behaviour as it guarantees
that the allocated buffer are zero initialized.

Reported-by: Vagrant Cascadian <vagrant@reproducible-builds.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Gbp-Pq: Topic reproducible
Gbp-Pq: Name 0001-fit_image-Use-calloc-to-fix-reproducibility-issue.patch
tools/fit_image.c