summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-04-27 14:11:38 +0200
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:03:50 -0600
commit4c0938f7f8118a17df896cedbfb215498b564cf2 (patch)
tree062f74fa9cb8b6a279398886e455a5166ea1a73e
parent1a9fbfee60db94894b7590ca298f8963b583c82b (diff)
downloadhqemu-4c0938f7f8118a17df896cedbfb215498b564cf2.zip
hqemu-4c0938f7f8118a17df896cedbfb215498b564cf2.tar.gz
vvfat: Fix volume name assertion
Commit d5941dd made the volume name configurable, but it didn't consider that the rw code compares the volume name string to assert that the first directory entry is the volume name. This made vvfat crash in rw mode. This fixes the assertion to compare with the configured volume name instead of a literal string. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--block/vvfat.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/vvfat.c b/block/vvfat.c
index 6b85314..ff3df35 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2283,12 +2283,17 @@ DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapp
factor * (old_cluster_count - new_cluster_count));
for (c = first_cluster; !fat_eof(s, c); c = modified_fat_get(s, c)) {
+ direntry_t *first_direntry;
void* direntry = array_get(&(s->directory), current_dir_index);
int ret = vvfat_read(s->bs, cluster2sector(s, c), direntry,
s->sectors_per_cluster);
if (ret)
return ret;
- assert(!strncmp(s->directory.pointer, "QEMU", 4));
+
+ /* The first directory entry on the filesystem is the volume name */
+ first_direntry = (direntry_t*) s->directory.pointer;
+ assert(!memcmp(first_direntry->name, s->volume_label, 11));
+
current_dir_index += factor;
}
OpenPOWER on IntegriCloud