All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header
@ 2018-09-20  8:12 Atsushi Nemoto
  2018-09-20 13:31 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Nemoto @ 2018-09-20  8:12 UTC (permalink / raw)
  To: u-boot

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);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header
  2018-09-20  8:12 [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header Atsushi Nemoto
@ 2018-09-20 13:31 ` Marek Vasut
  2018-09-21  0:10   ` Atsushi Nemoto
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2018-09-20 13:31 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header
  2018-09-20 13:31 ` Marek Vasut
@ 2018-09-21  0:10   ` Atsushi Nemoto
  0 siblings, 0 replies; 3+ messages in thread
From: Atsushi Nemoto @ 2018-09-21  0:10 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Thu, 20 Sep 2018 15:31:05 +0200, Marek Vasut <marek.vasut@gmail.com> wrote:
> 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 ?

Thank you for the review.  I will post a new patch soon.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-21  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20  8:12 [U-Boot] [PATCH] tools: socfpga: fix sfp_verify_header Atsushi Nemoto
2018-09-20 13:31 ` Marek Vasut
2018-09-21  0:10   ` Atsushi Nemoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.