[U-Boot] [Samsung] [PATCH v7 4/4] EXYNOS: SMDK5250: Add MMC SPL support
Mike Frysinger
vapier at gentoo.org
Thu Feb 9 06:34:45 CET 2012
On Thursday 09 February 2012 00:25:35 Chander Kashyap wrote:
> On 9 February 2012 09:21, Mike Frysinger wrote:
> > On Wednesday 08 February 2012 18:35:28 Doug Anderson wrote:
> >> On Thu, Feb 2, 2012 at 1:21 PM, Mike Frysinger wrote:
> >> > On Thursday 02 February 2012 04:11:27 Chander Kashyap wrote:
> >> > > +int main(int argc, char **argv)
> >> > > +{
> >> > > ...
> >> > > + unsigned char buffer[BUFSIZE] = {0};
> >> >
> >> > this is an implicit memset() and from what i can see in the code,
> >> > useless. you read() the entire buffer, so there's no need to
> >> > initialize it.
> >>
> >> Funny, I was just about to submit a patch to add this = {0} myself when
> >> I found this message. ;) I would say that it (or a memset, whichever
> >> people prefer) is a good idea so that this tool can be used to make a
> >> reasonable SPL out of any source binary executable, even ones that are
> >> smaller than 14K.
> >
> > you're right ... i'll claim that i was deceived by the lack of input
> > checking. sounds like the code should be aborting if the input is too
> > large instead of silently truncating. then the memset/{0} is
> > unnecessary:
> > - write out the data read
> > - lseek to the checksum position
> > - write checksum
> > - ftruncate to total length (16KiB?)
>
> BUFSIZE is already made 14K, so no need to ftruncate.
yes, in v9, it's 14KiB. i was looking at v7 which used 16KiB.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120209/47f258c0/attachment.pgp>
More information about the U-Boot
mailing list