From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avOWS-0002FC-EE for qemu-devel@nongnu.org; Wed, 27 Apr 2016 08:24:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avOWR-0001dy-Or for qemu-devel@nongnu.org; Wed, 27 Apr 2016 08:24:52 -0400 From: Kevin Wolf Date: Wed, 27 Apr 2016 14:24:42 +0200 Message-Id: <1461759883-8589-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1461759883-8589-1-git-send-email-kwolf@redhat.com> References: <1461759883-8589-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] vvfat: Fix volume name assertion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, w.bumiller@proxmox.com, eblake@redhat.com, mreitz@redhat.com, qemu-devel@nongnu.org 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 --- block/vvfat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 6b85314..f9d4e82 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2288,7 +2288,11 @@ DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapp 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 */ + direntry_t *first_direntry = s->directory.pointer; + assert(!memcmp(first_direntry->name, s->volume_label, 11)); + current_dir_index += factor; } -- 1.8.3.1