From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Wed, 04 Jan 2017 16:11:19 -0600 Subject: [U-Boot] [PATCH v2 1/14] nand: sunxi: Fix modulo by zero error In-Reply-To: <5b6deeb5f9c9496d9233248167969021d6060c3f.1479817585.git-series.maxime.ripard@free-electrons.com> References: <5b6deeb5f9c9496d9233248167969021d6060c3f.1479817585.git-series.maxime.ripard@free-electrons.com> Message-ID: <1483567879.17813.2.camel@buserror.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 2016-11-22 at 13:38 +0100, Maxime Ripard wrote: > When trying to autodetect the ECC and randomization configurations, the > driver starts with a randomization disabled and no seeds. > > In this case, the number of seeds is obviously 0, and the randomize boolean > is set to false. > > However, the logic that retrieves the seed for a given page offset will > blindly use the number of seeds, without testing if the randomization is > enabled, basically doing a modulo by 0. > > As it turns out, the libgcc in the common toolchain returns 0 here, which > was our expected value in such a case, and why we would not detect it. > However, U-Boot's libgcc will for some reason return from the function > instead, resulting in an error to load the U-Boot binary in the SPL. > > Signed-off-by: Maxime Ripard > --- > ?drivers/mtd/nand/sunxi_nand_spl.c | 7 ++++--- > ?1 file changed, 4 insertions(+), 3 deletions(-) Acked-by: Scott Wood -Scott