From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Sat, 26 Aug 2017 16:45:30 -0400 Subject: [U-Boot] fs: fat: fix fatwrite overflow calculation In-Reply-To: <20170813191617.6594-1-nfarnesi4@gmail.com> References: <20170813191617.6594-1-nfarnesi4@gmail.com> Message-ID: <20170826204530.GA2827@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, Aug 13, 2017 at 03:16:17PM -0400, Reno Farnesi wrote: > The overflow calculation was incorrect. Adding the start block of the > partition is not needed because the sectors are already relative to the > beginning of the partition. If you attempted to write a file smaller > than cur_part_info.start blocks on a full partition the old calculation > fails to catch the overflow. This would cause an infinite loop in the > determine_fatent function. > > Old, incorrect calculation: > > ending sector of new file = start sector + file size (in sectors) > last sector = partition start + total sectors on the partition > > Adding the partition start block number is not needed because sectors > are already relative to the start of the partition. > > New calculation: > > ending sector of new file = start sector + file size (in sectors) > last sector = total sectors on the partition > > Signed-off-by: Reno Farnesi Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: