diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-10-17 10:27:02 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-10-19 14:55:46 +0200 |
commit | 04788ba2edb4dc30c934e49581a8c645937667c5 (patch) | |
tree | 160815de87d86a18c6f46e802c412070e7c3b06b /block | |
parent | da7e92cac95fd3b7f91354d2d65b5d59ea36dc13 (diff) |
vpc: Fail open on bad header checksum
vpc_open() merely prints a warning when it finds a bad header
checksum. Turn that into a hard error.
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181017082702.5581-39-armbru@redhat.com>
[Error message capitalized for local consistency]
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/vpc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/block/vpc.c b/block/vpc.c index bf294abfa7..984187cadd 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -284,9 +284,11 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; - if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) - fprintf(stderr, "block-vpc: The header checksum of '%s' is " - "incorrect.\n", bs->filename); + if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) { + error_setg(errp, "Incorrect header checksum"); + ret = -EINVAL; + goto fail; + } /* Write 'checksum' back to footer, or else will leave it with zero. */ footer->checksum = cpu_to_be32(checksum); |