From nobody Mon Feb 9 11:08:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1604069230; cv=none; d=zohomail.com; s=zohoarc; b=QJafq5iUyTJLdm421ZNTJtYAQtTPFkiEuG1xtLCjUN/4NN8ROj4fNSntV3muXwD7HBw/G+zvsCaRhjwxGeSiNuLeUCq3otto3OFfu8wm3Cx6y4KPFjp/g6u+B9oxVTZvdDylJKzwilrC+Zde7mC6e8sIqnAkwuqdXVLMUX+T/9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604069230; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hlsm+wF9UFkXPwt1j9RFco/39Ps2eiDuJP+GLP7cLJs=; b=RNK33xCx/5CXwrKZdgnj7Rtfb7M/S8KfUvAsAQf3VuCmji5SDORP3PW0EF86nvdVp2NeJxZ1noAJP3bVnEMDgEJuF7Tg2vm20rBPTB0n2HAwB0OHudJylJr0oXdcm4q/jjtL+xoKTJi4Oyy5IxwkzsEf1VYvhYws2l1Glwgpijk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604069230948287.2264207292675; Fri, 30 Oct 2020 07:47:10 -0700 (PDT) Received: from localhost ([::1]:38988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVgL-0002hN-Dx for importer@patchew.org; Fri, 30 Oct 2020 10:47:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVeI-0000X9-98 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:04 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:33331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVeF-00035Y-OK for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=hlsm+wF9UFkXPwt1j9RFco/39Ps2eiDuJP+GLP7cLJs=; b=XjeU1 9PHREX2H9nsTVGOIo9rKI0Qs7Tp1BYef19LQ+sHBmNzjbwos+iAccSfPIsSa99lycqW6AotiOFzay UMf+VWRHkByqCnnLbTiFzoshoIkIcddlpnhlfDospFZD2pRy6dT+00A5ruDCGnVRatj8fFvMTpez0 rSRXZPKbYHyKh+XC2eGkfQGsfYqrfpeaDdDsjGathstmS8Q2GfefsmtKfVn0iHB5SuTH7wF98LbNM EK7BtM+e7+3bN9r3x8pBOmQevVGHeYo7LXErvPDAtJw2REFvPU15NPeOVsX4y5r8GRybPXlWQkQ0c Cn4SbMfuIQXSdfhjKI6rqjzYqHjFQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 30 Oct 2020 13:07:03 +0100 Subject: [PULL v2 02/16] tests/9pfs: fix coverity error in create_local_test_dir() To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=91.194.90.13; envelope-from=de48a58b7714b50df0f1ed5ec1b64e06a72e17ee@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Coverity wants the return value of mkdir() to be checked: /qemu/tests/qtest/libqos/virtio-9p.c: 48 in create_local_test_dir() 42 /* Creates the directory for the 9pfs 'local' filesystem driver to access. */ 43 static void create_local_test_dir(void) 44 { 45 struct stat st; 46 47 g_assert(local_test_path !=3D NULL); >>> CID 1435963: Error handling issues (CHECKED_RETURN) >>> Calling "mkdir(local_test_path, 511U)" without checking return value. This library function may fail and return an error code. 48 mkdir(local_test_path, 0777); 49 50 /* ensure test directory exists now ... */ 51 g_assert(stat(local_test_path, &st) =3D=3D 0); 52 /* ... and is actually a directory */ 53 g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); So let's just do that and log an info-level message at least, because we actually only care if the required directory exists and we do have an existence check for that in place already. Reported-by: Coverity (CID 1435963) Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <03f68c7ec08064e20f43797f4eb4305ad21e1e8e.1604061839.git.qemu_o= ss@crudebyte.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/libqos/virtio-9p.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c index 6b22fa0e9a..8459a3ee58 100644 --- a/tests/qtest/libqos/virtio-9p.c +++ b/tests/qtest/libqos/virtio-9p.c @@ -48,9 +48,14 @@ static void init_local_test_path(void) static void create_local_test_dir(void) { struct stat st; + int res; =20 g_assert(local_test_path !=3D NULL); - mkdir(local_test_path, 0777); + res =3D mkdir(local_test_path, 0777); + if (res < 0) { + g_test_message("mkdir('%s') failed: %s", local_test_path, + strerror(errno)); + } =20 /* ensure test directory exists now ... */ g_assert(stat(local_test_path, &st) =3D=3D 0); --=20 2.20.1