From nobody Thu Nov 6 10:24:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540212302390419.6714234053103; Mon, 22 Oct 2018 05:45:02 -0700 (PDT) Received: from localhost ([::1]:34814 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEZZt-00041Q-7Q for importer@patchew.org; Mon, 22 Oct 2018 08:45:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEZPo-0002PG-Pu for qemu-devel@nongnu.org; Mon, 22 Oct 2018 08:34:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEZPm-0003Bb-7j for qemu-devel@nongnu.org; Mon, 22 Oct 2018 08:34:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEZPl-0002xc-PB for qemu-devel@nongnu.org; Mon, 22 Oct 2018 08:34:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 238B2316499A for ; Mon, 22 Oct 2018 12:34:22 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-34.ams2.redhat.com [10.36.117.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E26C860155; Mon, 22 Oct 2018 12:34:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D89AD1162B64; Mon, 22 Oct 2018 14:34:14 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 22 Oct 2018 14:34:12 +0200 Message-Id: <20181022123413.28044-40-armbru@redhat.com> In-Reply-To: <20181022123413.28044-1-armbru@redhat.com> References: <20181022123413.28044-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 22 Oct 2018 12:34:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 39/40] vpc: Fail open on bad header checksum X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" vpc_open() merely prints a warning when it finds a bad header checksum. Turn that into a hard error. Cc: Kevin Wolf Signed-off-by: Markus Armbruster Message-Id: <20181017082702.5581-39-armbru@redhat.com> [Error message capitalized for local consistency] Reviewed-by: Kevin Wolf --- block/vpc.c | 8 +++++--- 1 file 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 *optio= ns, int flags, =20 checksum =3D be32_to_cpu(footer->checksum); footer->checksum =3D 0; - if (vpc_checksum(s->footer_buf, HEADER_SIZE) !=3D checksum) - fprintf(stderr, "block-vpc: The header checksum of '%s' is " - "incorrect.\n", bs->filename); + if (vpc_checksum(s->footer_buf, HEADER_SIZE) !=3D checksum) { + error_setg(errp, "Incorrect header checksum"); + ret =3D -EINVAL; + goto fail; + } =20 /* Write 'checksum' back to footer, or else will leave it with zero. */ footer->checksum =3D cpu_to_be32(checksum); --=20 2.17.2