tools: socfpga: fix sfp_verify_header
PATCH 1/1 tools: socfpga: fix sfp_verify_header
Fix sfp_verify_header to return correct version number.
This fixes "Not a sane SOCFPGA preloader" error message with v1 header.
--- tools/socfpgaimage.c | 1 + 1 file changed, 1 insertion(+)
tools/socfpgaimage.c +1 -0
@@ -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 );
Signature · 1 line
2.1.4
PATCH 1/1 tools: socfpga: fix sfp_verify_header
Quoted 14 lines · Atsushi Nemoto
Fix
sfp_verify_headerto return correct version number.
This fixes "Not a sane SOCFPGA preloader" error message with v1 header.Signed-off-by Atsushi Nemoto <[email protected]>--- tools/socfpgaimage.c | 1 + 1 file changed, 1 insertion(+)tools/socfpgaimage.c +0
-0
tools/socfpgaimage.c static int sfp_verify_header(const uint8_t *buf, uint8_t *ver) · line 180
Quoted 7 lines
tools/socfpgaimage.c +1
-0@@ -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!
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 tools: socfpga: fix sfp_verify_header
Hi Marek,
Quoted 3 lines · Marek Vasut
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