public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header
Date: Thu, 20 Sep 2018 15:31:05 +0200	[thread overview]
Message-ID: <701c4cf6-7b82-e8df-9321-dced899ae571@gmail.com> (raw)
In-Reply-To: <20180920.171205.1325424105590519679.atsushi.nemoto@sord.co.jp>

On 09/20/2018 10:12 AM, Atsushi Nemoto wrote:
> Fix sfp_verify_header to return correct version number.
> This fixes "Not a sane SOCFPGA preloader" error message with v1 header.
> 
> Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
> ---
>  tools/socfpgaimage.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
> index 390c9bb..fea22b4 100644
> --- a/tools/socfpgaimage.c
> +++ b/tools/socfpgaimage.c
> @@ -174,6 +174,7 @@ static int sfp_verify_header(const uint8_t *buf, uint8_t *ver)
>  	if (le32_to_cpu(header_v0.validation) != VALIDATION_WORD)
>  		return -1;
>  
> +	*ver = header_v0.version;
>  	if (header_v0.version == 0) {
>  		hdr_csum = le16_to_cpu(header_v0.checksum);
>  		sfp_csum = sfp_hdr_checksum((uint8_t *)&header_v0, 0);
> 

Hello Nemoto-san,

This *ver assignment should be just before return img_len, so we don't
set the *ver until we did all the checks. Otherwise it's good. Can you
send a V2 ?

Thanks!

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2018-09-20 13:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  8:12 [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header Atsushi Nemoto
2018-09-20 13:31 ` Marek Vasut [this message]
2018-09-21  0:10   ` Atsushi Nemoto

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=701c4cf6-7b82-e8df-9321-dced899ae571@gmail.com \
    --to=marek.vasut@gmail.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