From patchwork Wed Feb 26 13:12:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11406465 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F01714B4 for ; Wed, 26 Feb 2020 13:14:15 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BF3020726 for ; Wed, 26 Feb 2020 13:14:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="GDMZAEtM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BF3020726 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6wUS-0006Na-6d; Wed, 26 Feb 2020 13:12:40 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6wUR-0006NU-DP for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 13:12:39 +0000 X-Inumbo-ID: a9966de2-5899-11ea-941d-12813bfff9fa Received: from smtp-fw-6001.amazon.com (unknown [52.95.48.154]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a9966de2-5899-11ea-941d-12813bfff9fa; Wed, 26 Feb 2020 13:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1582722759; x=1614258759; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fBE0+1Pww5eSNMyydAINI5Bctpc982EIY3WpsCpCImQ=; b=GDMZAEtM5E7yQss7Q+jmfRVFbfkaEQo+pEc4A3wUAbLtWV+SDWS1H3VA GuBNmzSsDTGqUOgC812mP3Mpk/cTmhWQmqkRebw4eDp5bkw3glj/Werl6 QjwyNoxERJRrLUYrhphKUdUmjIX9c77nBp4IVQhZJYD28+G3tOoKfprjh U=; IronPort-SDR: 5JDSvjivX7Ic1qDbHr+VW8TC4JsURtPWD10B881vgNbZWBhs7OGXvNTnFX8t2GSb/KxVyzJWYi nio1Mgz0MlqQ== X-IronPort-AV: E=Sophos;i="5.70,488,1574121600"; d="scan'208";a="19752916" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-27fb8269.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 26 Feb 2020 13:12:26 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-27fb8269.us-east-1.amazon.com (Postfix) with ESMTPS id C1824A1E75; Wed, 26 Feb 2020 13:12:24 +0000 (UTC) Received: from EX13D32EUB002.ant.amazon.com (10.43.166.114) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 26 Feb 2020 13:12:24 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D32EUB002.ant.amazon.com (10.43.166.114) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 26 Feb 2020 13:12:22 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 26 Feb 2020 13:12:20 +0000 From: Paul Durrant To: Date: Wed, 26 Feb 2020 13:12:13 +0000 Message-ID: <20200226131213.15305-1-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH] libxl: add initializers for libxl__domid_history X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This patch fixes Coverity issue CID 1459006 (Insecure data handling (INTEGER_OVERFLOW)). The problem is that the error paths for libxl__mark_domid_recent() and libxl__is_domid_recent() check the 'f' field in struct libxl__domid_history when it may not have been initialized. Signed-off-by: Paul Durrant Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD --- tools/libxl/libxl_domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index 8937aeb260..41d08394f3 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -1390,7 +1390,7 @@ static int libxl__read_recent(libxl__gc *gc, static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) { libxl__flock *lock; - struct libxl__domid_history ctxt; + struct libxl__domid_history ctxt = {}; char *new; FILE *nf = NULL; int r, rc; @@ -1461,7 +1461,7 @@ out: int libxl__is_domid_recent(libxl__gc *gc, uint32_t domid, bool *recent) { - struct libxl__domid_history ctxt; + struct libxl__domid_history ctxt = {}; int rc; rc = libxl__open_domid_history(gc, &ctxt);