From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
Date: Sun, 29 Jan 2023 17:45:55 +0100 [thread overview]
Message-ID: <20230129164555.9940-3-pali@kernel.org> (raw)
In-Reply-To: <20230129164555.9940-1-pali@kernel.org>
gpimage type requires only that two first 32-bit words of data file are
non-zero. So basically every random data file can be guessed and verified
as gpimage. So completely skip gpimage type from image autodetection code
to prevent lot of false positive results. Data file with gpimage type can
be still verified and parsed by explicitly specifying -T gpimage.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
tools/imagetool.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/imagetool.c b/tools/imagetool.c
index e1021f44f5ad..87eee4ad04ed 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -49,6 +49,12 @@ int imagetool_verify_print_header(
return imagetool_verify_print_header_by_type(ptr, sbuf, tparams, params);
for (curr = start; curr != end; curr++) {
+ /*
+ * Basically every data file can be guessed / verified as gpimage,
+ * so skip autodetection of data file as gpimage as it does not work.
+ */
+ if ((*curr)->check_image_type && (*curr)->check_image_type(IH_TYPE_GPIMAGE) == 0)
+ continue;
if ((*curr)->verify_header) {
retval = (*curr)->verify_header((unsigned char *)ptr,
sbuf->st_size, params);
--
2.20.1
next prev parent reply other threads:[~2023-01-29 16:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 16:45 [PATCH u-boot 1/3] tools: imagetool: Fix error message when verify_header is undefined Pali Rohár
2023-01-29 16:45 ` [PATCH u-boot 2/3] tools: imagetool: Show error message when detecting image type failed Pali Rohár
2023-02-07 16:53 ` Tom Rini
2023-01-29 16:45 ` Pali Rohár [this message]
2023-01-30 15:50 ` [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type Simon Glass
2023-01-30 18:02 ` Tom Rini
2023-02-03 19:24 ` Pali Rohár
2023-02-03 20:23 ` Tom Rini
2023-02-07 16:53 ` Tom Rini
2023-01-30 15:50 ` [PATCH u-boot 1/3] tools: imagetool: Fix error message when verify_header is undefined Simon Glass
2023-02-07 16:53 ` Tom Rini
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=20230129164555.9940-3-pali@kernel.org \
--to=pali@kernel.org \
--cc=sjg@chromium.org \
--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