From: Alban Bedel <alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Alban Bedel
<alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [cbootimage PATCH 2/3] Fix image update with image smaller than 10KiB
Date: Tue, 8 Dec 2015 15:27:23 +0100 [thread overview]
Message-ID: <20151208152723.6b477e01@avionic-0020> (raw)
In-Reply-To: <5665BFF8.5030205-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]
On Mon, 7 Dec 2015 10:20:56 -0700
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 12/07/2015 04:51 AM, Alban Bedel wrote:
> > On Wed, 11 Nov 2015 09:36:37 -0700
> > Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> >
> >> On 11/05/2015 09:03 AM, Alban Bedel wrote:
> >>> The BCT size check assume a quiet large image, however if the image
> >>> doesn't contains a bootloader it won't be that large. Change the size
> >>> check to check for the smallest possible BCT size which is currently
> >>
> >>> diff --git a/src/cbootimage.h b/src/cbootimage.h
> >>
> >>> +#define NVBOOT_CONFIG_TABLE_SIZE_MIN 4080
> >>
> >> I think a comment is warranted here. This value needs to be (a) small
> >> enough that it isn't larger than the total BCT size on any chip, and (b)
> >> large enough that it includes the bct->boot_data_version field for all
> >> chips. (Hopefully those two constraints can continue to be met with a
> >> single value in the future...)
> >
> > I'll add this in the next patch.
> >
> >>> diff --git a/src/data_layout.c b/src/data_layout.c
> >>
> >>> @@ -1052,7 +1052,7 @@ int get_bct_size_from_image(build_image_context *context)
> >>> if (!fp)
> >>> return -ENODATA;
> >>>
> >>> - if (fread(buffer, 1, NVBOOT_CONFIG_TABLE_SIZE_MAX, fp) != NVBOOT_CONFIG_TABLE_SIZE_MAX) {
> >>> + if (fread(buffer, 1, NVBOOT_CONFIG_TABLE_SIZE_MAX, fp) < NVBOOT_CONFIG_TABLE_SIZE_MIN) {
> >>
> >> Can you please also update the size of buffer[]:
> >
> > No, we still need to read up to NVBOOT_CONFIG_TABLE_SIZE_MAX if needed.
>
> Why? This data that's read is solely used to determine the size of the
> BCT, and then thrown away. I don't believe any of the data between
> SIZE_MIN and SIZE_MAX should ever be used; observe the following at the
> end of the function:
>
> context->bct = buffer;
> if (data_is_valid_bct(context) && g_soc_config->get_bct_size)
> bct_size = g_soc_config->get_bct_size();
>
> fclose(fp);
> context->bct = 0; <<<<<<<<
Right, I overlooked that, v3 is under way.
Alban
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-12-08 14:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-05 16:03 [cbootimage PATCH 0/3] RSA on T124 and misc fixes Alban Bedel
[not found] ` <1446739402-14238-1-git-send-email-alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2015-11-05 16:03 ` [cbootimage PATCH 1/3] Fix the error reporting of get_bct_size_from_image() Alban Bedel
[not found] ` <1446739402-14238-2-git-send-email-alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2015-11-11 16:31 ` Stephen Warren
2015-11-05 16:03 ` [cbootimage PATCH 2/3] Fix image update with image smaller than 10KiB Alban Bedel
[not found] ` <1446739402-14238-3-git-send-email-alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2015-11-11 16:36 ` Stephen Warren
[not found] ` <56436E95.8000305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-12-07 11:51 ` Alban Bedel
2015-12-07 17:20 ` Stephen Warren
[not found] ` <5665BFF8.5030205-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-12-08 14:27 ` Alban Bedel [this message]
2015-11-05 16:03 ` [cbootimage PATCH 3/3] Add support to read and write rsa related fields on t124 Alban Bedel
[not found] ` <1446739402-14238-4-git-send-email-alban.bedel-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2015-11-11 16:41 ` Stephen Warren
[not found] ` <56436FA4.3070906-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-11-11 16:56 ` Alban Bedel
2015-11-11 17:04 ` Stephen Warren
2015-11-11 16:30 ` [cbootimage PATCH 0/3] RSA on T124 and misc fixes Stephen Warren
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=20151208152723.6b477e01@avionic-0020 \
--to=alban.bedel-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
/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