From: Claudio Fontana <cfontana@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, dinechin@redhat.com,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Claudio Fontana" <cfontana@suse.de>
Subject: [PATCH v8 4/5] dmg: warn when opening dmg images containing blocks of unknown type
Date: Wed, 28 Sep 2022 14:29:58 +0200 [thread overview]
Message-ID: <20220928122959.16679-5-cfontana@suse.de> (raw)
In-Reply-To: <20220928122959.16679-1-cfontana@suse.de>
From: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
block/dmg.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/block/dmg.c b/block/dmg.c
index 837f18aa20..96f8c2d14f 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -254,6 +254,25 @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {
s->types[i] = buff_read_uint32(buffer, offset);
if (!dmg_is_known_block_type(s->types[i])) {
+ switch (s->types[i]) {
+ case UDBZ:
+ warn_report_once("dmg-bzip2 module is missing, accessing bzip2 "
+ "compressed blocks will result in I/O errors");
+ break;
+ case ULFO:
+ warn_report_once("dmg-lzfse module is missing, accessing lzfse "
+ "compressed blocks will result in I/O errors");
+ break;
+ case UDCM:
+ case UDLE:
+ /* Comments and last entry can be ignored without problems */
+ break;
+ default:
+ warn_report_once("Image contains chunks of unknown type %x, "
+ "accessing them will result in I/O errors",
+ s->types[i]);
+ break;
+ }
chunk_count--;
i--;
offset += 40;
--
2.26.2
next prev parent reply other threads:[~2022-09-28 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 12:29 [PATCH v8 0/5] improve error handling for module load Claudio Fontana
2022-09-28 12:29 ` [PATCH v8 1/5] module: removed unused function argument "mayfail" Claudio Fontana
2022-09-28 12:29 ` [PATCH v8 2/5] module: rename module_load_one to module_load Claudio Fontana
2022-09-28 15:28 ` Richard Henderson
2022-09-28 12:29 ` [PATCH v8 3/5] module: add Error arguments to module_load and module_load_qom Claudio Fontana
2022-09-28 15:38 ` Richard Henderson
2022-09-28 12:29 ` Claudio Fontana [this message]
2022-09-28 15:39 ` [PATCH v8 4/5] dmg: warn when opening dmg images containing blocks of unknown type Richard Henderson
2022-09-28 12:29 ` [PATCH v8 5/5] accel: abort if we fail to load the accelerator plugin Claudio Fontana
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=20220928122959.16679-5-cfontana@suse.de \
--to=cfontana@suse.de \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dinechin@redhat.com \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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;
as well as URLs for NNTP newsgroup(s).