From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer
Date: Sat, 14 Dec 2013 14:07:57 +0900 [thread overview]
Message-ID: <52ABE7AD.2060305@samsung.com> (raw)
In-Reply-To: <20131213100000.41df0c9d@lilith>
Dear Albert,
On 13/12/13 18:00, Albert ARIBAUD wrote:
> (adding Minkyu as the Samsung custodian)
>
> On Mon, 9 Dec 2013 18:09:18 +0100, Albert ARIBAUD
> <albert.u.boot@aribaud.net> wrote:
>
>> mkexynos reads its input file which might be smaller than
>
> ( typo: s/mkexynos/mkexynosspl/ -- wil fix when applying if thee is
> no other change to be made )
>
>> its read buffer, but always writes the whole buffer out.
>> This does not affect the functionalyty of the output file,
>> but it makes its content unpredictable as the end of the
>> buffer is never initialized. Fix this by zeroing the buffer
>> before reading the input file.
>
> Minkyu: should the buffer be pre-filled with zeroes or should I use
> ones instead? Or maybe the output could be truncated to the size of the
> input?
Basically, the output file is fixed to 14K as same as buffer size.
And the input file should be smaller than 14K.
It's the rule of exynos spl.
The role of mkexynosspl is just adding 4 byte checksum value to end of file.
If the input file is bigger than 14K, output will be truncated.
>
> Amicalement,
> Albert.
>
>> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
btw, this change looks reasonable to me.
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>> Changes in v3:
>> - fixed mkexynosspl uninitialized buffer
>>
>> Changes in v2: None
>>
>> tools/mkexynosspl.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/mkexynosspl.c b/tools/mkexynosspl.c
>> index ef685b7..8d605fa 100644
>> --- a/tools/mkexynosspl.c
>> +++ b/tools/mkexynosspl.c
>> @@ -72,6 +72,8 @@ int main(int argc, char **argv)
>>
>> count = (len < CHECKSUM_OFFSET) ? len : CHECKSUM_OFFSET;
>>
>> + memset(buffer, 0, BUFSIZE);
>> +
>> if (read(ifd, buffer, count) != count) {
>> fprintf(stderr, "%s: Can't read %s: %s\n",
>> argv[0], argv[1], strerror(errno));
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Thanks,
Minkyu Kang.
next prev parent reply other threads:[~2013-12-14 5:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 17:09 [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer Albert ARIBAUD
2013-12-09 17:09 ` [U-Boot] [PATCH v3 2/4] cm_t335: fix linker file to produce full ELF Albert ARIBAUD
2013-12-09 17:09 ` [U-Boot] [PATCH v3 3/4] arm: make _end compiler-generated Albert ARIBAUD
2013-12-09 17:09 ` [U-Boot] [PATCH v3 4/4] arm: remove unneeded symbol offsets and _TEXT_BASE Albert ARIBAUD
2013-12-13 9:00 ` [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer Albert ARIBAUD
2013-12-14 5:07 ` Minkyu Kang [this message]
2013-12-14 10:14 ` Albert ARIBAUD
2013-12-16 0:48 ` Minkyu Kang
2013-12-16 7:42 ` Rajeshwari Birje
2013-12-21 9:44 ` Albert ARIBAUD
2013-12-23 8:41 ` Minkyu Kang
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=52ABE7AD.2060305@samsung.com \
--to=mk7.kang@samsung.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