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: [U-Boot] fs: fat: fix fatwrite overflow calculation
Date: Sat, 26 Aug 2017 16:45:30 -0400	[thread overview]
Message-ID: <20170826204530.GA2827@bill-the-cat> (raw)
In-Reply-To: <20170813191617.6594-1-nfarnesi4@gmail.com>

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 <nfarnesi4@gmail.com>

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: <http://lists.denx.de/pipermail/u-boot/attachments/20170826/2d3b263d/attachment.sig>

      reply	other threads:[~2017-08-26 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-13 19:16 [U-Boot] [PATCH] fs: fat: fix fatwrite overflow calculation Reno Farnesi
2017-08-26 20:45 ` Tom Rini [this message]

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=20170826204530.GA2827@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