From: Tom Rini Date: Mon, 14 Sep 2020 15:40:57 -0400 Subject: [PATCH] mtd: nand: Fix nand write error with bad block addresses above 32-bit In-Reply-To: References: Message-ID: <20200914194057.GX5110@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 Mon, Aug 31, 2020 at 02:27:37PM +0200, Michal Simek wrote: > From: T Karthik Reddy > > Nand writes should skip the bad blocks with "nand write" command. > In case of bad blocks with above 32-bit address, nand_block_isbad() > returns false due to truncated bad block address. > > In below code segment, > > if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) > > offset is 64-bit and mtd->erasesize is 32-bit, hence the truncation is > happening. Cast 'mtd->erasesize' with loff_t to fix this issue. > > Signed-off-by: T Karthik Reddy > Signed-off-by: Michal Simek Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: