From patchwork Mon Dec 16 16:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13910009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10D12E7717F for ; Mon, 16 Dec 2024 16:14:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNDk2-0007TC-D1; Mon, 16 Dec 2024 11:14:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDjj-0007QM-3J for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDjh-00075Q-0K for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734365659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CvherdBf5rf3JXCiMOjI4Z7bSXnBurw8KTrk/OuOE+M=; b=dmaTNZQ3sZdBIRh2k0R2prSEo4tj08OdXok3/NYjvlXRLeCTBW/pqLkEWB9TKnkF6+AVhe lI83nxbaQUg7/K0D3imQB1rvpH/yLtL4OPt+qOHjq137yN2mg4f71BYCjAdE/SO8+OEVun JaQOmXA8W2W8uiwQN/4IFglw+/u2MAM= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-314-ONouCXh3PKOcQXX_I26Nvw-1; Mon, 16 Dec 2024 11:14:18 -0500 X-MC-Unique: ONouCXh3PKOcQXX_I26Nvw-1 X-Mimecast-MFC-AGG-ID: ONouCXh3PKOcQXX_I26Nvw Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3a9cd0b54c1so45536135ab.0 for ; Mon, 16 Dec 2024 08:14:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734365657; x=1734970457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CvherdBf5rf3JXCiMOjI4Z7bSXnBurw8KTrk/OuOE+M=; b=iZmzlfgLrDJmMwPt4qT1Ibq2Ca64BBOwhjBeR89tjhLgn/dy/ZfI0bDGZ6VhKm96bk eZsFN9/UO8ez3gi9TeCcTvH3P0yxD3m1DUpC3CLpcUh2SjrCxgHydp1R6c+4Qk8mtxxQ DZKSFUEq3RIIbj0Ms5nkdAAobeQ74/+M7jfauVNjTSFyEkUv+zhQxO7nM86LyCxcgfaR DyPNobnoBz8ML7qEr8pkp24eUjKezghuUqi4WYl223kDr7S9kiedD17JFBUR/mZHQk15 E2DQzha5D8HhjpUQzOopr9ywndv2xpQcug0PWpq22QVwl4F25xCgDo6s89CKrZO7ZPsn TsRg== X-Gm-Message-State: AOJu0YzGotknxtl0/3qgnUY8Uy8xgXdKRu4Sd968HpSLKbCayCA91Vyu CZ1u0PMq/Rkb+NS+m7C3gOoAeLaSLuMaKFAo9va+RZPz+6LK2+/DddZiqpVp7H33D67dFfr7MAj x6aTV5G98hH43nQa7K3BApyk9O3yX4u130is17/rwfE+hIRpckdzorYKq/fHO8sfaK27PH8UA/W ieDRDhFK23RPqc+YyK5kh1hkkpiFIgCJlldw== X-Gm-Gg: ASbGncu7xto53uTQq0MPnsfM1sQs+a86Zng0T5lQfHIFdj4trrZ15LhjheeUAmGFKs7 FUqKZNcrTd8MGCPoyf4ysG800c23hqbqa6DHJh7u9LYylW2Qv4mQAEqEz7zxAjW7q9kP/UQz9/y LNuSnWF6JrXOo02HPpPcKhfk2hxLU+yX/L0qpPH8U8ft+W/shKBWsF0eHOwuI2KoE+ZlW5PkqBi JMH3X8atLxhOCZQadu7nRk5nBfSUSy2ta2r7QDXNWffyYMaJr1zHv2+hQsk1VpcqBWSE8+78oBl woq4Fqud6P28HcRmhXlX X-Received: by 2002:a05:6e02:1a84:b0:3a7:8720:9de8 with SMTP id e9e14a558f8ab-3afee9a26a9mr141621075ab.5.1734365657362; Mon, 16 Dec 2024 08:14:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdkqi5dSMkPNwgvZ9pg24TKari3UnSfuMVbqp9yvxokvS1Npp0k7HVuMJnMzeY1CEbI8hLxQ== X-Received: by 2002:a05:6e02:1a84:b0:3a7:8720:9de8 with SMTP id e9e14a558f8ab-3afee9a26a9mr141620705ab.5.1734365656922; Mon, 16 Dec 2024 08:14:16 -0800 (PST) Received: from x1n.. (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3b248cb74fbsm15895765ab.34.2024.12.16.08.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 08:14:16 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Michael Roth , peterx@redhat.com, Fabiano Rosas , Konstantin Kostiuk Subject: [PATCH 1/3] osdep: Add qemu_mkdir_with_parents() Date: Mon, 16 Dec 2024 11:14:11 -0500 Message-ID: <20241216161413.1644171-2-peterx@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241216161413.1644171-1-peterx@redhat.com> References: <20241216161413.1644171-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.13, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org QEMU uses g_mkdir_with_parents() a lot, especially in the case where the failure case is ignored so an abort is expected when happened. Provide a helper qemu_mkdir_with_parents() to do that, and use it in the two cases in qga/. To be used in more places later. Signed-off-by: Peter Xu Reviewed-by: Alex Bennée --- include/qemu/osdep.h | 7 +++++++ qga/commands-posix-ssh.c | 8 ++------ util/osdep.c | 6 ++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index fdff07fd99..dc67fb2e5e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -828,6 +828,13 @@ static inline int platform_does_not_support_system(const char *command) } #endif /* !HAVE_SYSTEM_FUNCTION */ +/** + * qemu_mkdir_with_parents: + * + * Create directories with parents. Abort on failures. + */ +void qemu_mkdir_with_parents(const char *dir, int mode); + #ifdef __cplusplus } #endif diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index 246171d323..a39abcbaa5 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -18,7 +18,6 @@ static struct passwd * test_get_passwd_entry(const gchar *user_name, GError **error) { struct passwd *p; - int ret; if (!user_name || g_strcmp0(user_name, g_get_user_name())) { g_set_error(error, G_UNIX_ERROR, 0, "Invalid user name"); @@ -30,8 +29,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error) p->pw_uid = geteuid(); p->pw_gid = getegid(); - ret = g_mkdir_with_parents(p->pw_dir, 0700); - g_assert(ret == 0); + qemu_mkdir_with_parents(p->pw_dir, 0700); return p; } @@ -263,11 +261,9 @@ test_authorized_keys_set(const char *contents) { g_autoptr(GError) err = NULL; g_autofree char *path = NULL; - int ret; path = g_build_filename(g_get_home_dir(), ".ssh", NULL); - ret = g_mkdir_with_parents(path, 0700); - g_assert(ret == 0); + qemu_mkdir_with_parents(path, 0700); g_free(path); path = test_get_authorized_keys_path(); diff --git a/util/osdep.c b/util/osdep.c index 770369831b..3a724c1814 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -613,3 +613,9 @@ int qemu_fdatasync(int fd) return fsync(fd); #endif } + +void qemu_mkdir_with_parents(const char *dir, int mode) +{ + int ret = g_mkdir_with_parents(dir, 0700); + g_assert(ret == 0); +} From patchwork Mon Dec 16 16:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13910010 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9B95E7717F for ; Mon, 16 Dec 2024 16:14:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNDk5-0007UF-Ut; Mon, 16 Dec 2024 11:14:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDjk-0007Qi-Db for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDji-00075d-SA for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734365661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wkjcazPwHvsy47bb6YhA4CwXiaPpEKId/bwPUAugxmI=; b=IT7MCE8hT9xmiD3rw0mXAounnuuDQpy146Q+oCV4I6LsIqsWaqgyYs655BFJKuvLgQHopO 4fPhLUrLNiUKF0YGG9wgNHnK4qJW9mzNSqX7NIGJxyryRj4P9FGGQaTdSLNVg1qB6oOG1g UtCMs/zrTWFHes8WAy/9+OlEDYh6row= Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-104-SbuUYto1N3CcKfQRQsDnAw-1; Mon, 16 Dec 2024 11:14:20 -0500 X-MC-Unique: SbuUYto1N3CcKfQRQsDnAw-1 X-Mimecast-MFC-AGG-ID: SbuUYto1N3CcKfQRQsDnAw Received: by mail-il1-f200.google.com with SMTP id e9e14a558f8ab-3a9d075bdc3so82277935ab.3 for ; Mon, 16 Dec 2024 08:14:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734365658; x=1734970458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wkjcazPwHvsy47bb6YhA4CwXiaPpEKId/bwPUAugxmI=; b=Wyy/rWixNYt5Q2kmbgFor6fCWl5Oc+obHbv7zVcGzkxm8RZqGYEe2LC6G6gL5dX8V+ KdjOc97fntn9N6bd3aHz8yVHOiHF4SLJ2vmQFpyEgFyZt9JQuAIh1vor/XvPUP4TeMGu HhixIm7id9Ilr0ExhH7F4dd1Z0Png3ewAfJjFEq/1X3Si7AYrUPdupIvfUbw18xJ05v8 PAdJ2PQTGIyXzZwPwlbtTN7JYbrB6iq4RiTKCmrjQCpt8Pzby7NqbcMkerfiu2IPjTda xUcNtZoY1GHJ7hOtRJUFjoPOuYCEHYbLQU6nEGJvAo0nAEyvJ9EIw+wOkgSXQvHKH0+y CXBQ== X-Gm-Message-State: AOJu0YzHo6WuI7rPHTn2AT5lt5e1cFonfFGCl04toEVPTKwyxBC9ibRi vS+cN72M0D9pEV2wpA9nHhPr+KwDPqQqFbNb09/TkXo2qiHi+OhTvdqNOp+b+qUy0kKPGbPHOkk TcJCYiEfBhrN0qJ+SkP+ZxqDRwgY4IIROxgzwCJJZYzoVmvS0wMEQ9+Zm8qKZ7vjX1vxs269+a7 +5IhRYAYAfmkqKgeNoU9CLzsdtmovwilFJSg== X-Gm-Gg: ASbGncuqdIgwDg0wHCGGh/ztTfYxXkAsxaD+w3DLtoQ4D3GvrD76dk7zltm7uS3lvk0 M9UcxK1SHBCNm41AAswVwa9dSOlLjR2AYxWCQFBDmvCAAhWEsh3S/N2i51cqSqdS3CS+f9W/Pfn 861qes9/aCAESoRra+b1dfaXOkUnRMiJ/XCpPXJnOrU7YQZJsh5feRRPEPqwRoITQ1eztZp8Is3 lO3RcKbNPD0CeXPO0wpdCJeD3yKdL87YJSnfVdJ3ZPSPX03aknvRlNNu8f/wZPGvU1uOHj/CxFv B5aF7/GR9WGfU8AHOoPp X-Received: by 2002:a05:6e02:1a45:b0:3a7:6f5a:e5c7 with SMTP id e9e14a558f8ab-3aff461ad34mr115509035ab.4.1734365658693; Mon, 16 Dec 2024 08:14:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUtpIHyDwFhQBaCPjNZgp6mHZpmASj9/Hc5sy65v8K/g5A7LbNB8fPrrlcyw+nN1BATOr2Dg== X-Received: by 2002:a05:6e02:1a45:b0:3a7:6f5a:e5c7 with SMTP id e9e14a558f8ab-3aff461ad34mr115508845ab.4.1734365658367; Mon, 16 Dec 2024 08:14:18 -0800 (PST) Received: from x1n.. (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3b248cb74fbsm15895765ab.34.2024.12.16.08.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 08:14:17 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Michael Roth , peterx@redhat.com, Fabiano Rosas , Konstantin Kostiuk Subject: [PATCH 2/3] tests: Use qemu_mkdir_with_parents() for all test code Date: Mon, 16 Dec 2024 11:14:12 -0500 Message-ID: <20241216161413.1644171-3-peterx@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241216161413.1644171-1-peterx@redhat.com> References: <20241216161413.1644171-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.13, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Coverity isn't happy on the QEMU test cases where g_mkdir_with_parents() is used without checking retvals. Use qemu_mkdir_with_parents() to fix them. Resolves: Coverity CID 1568381 Resolves: Coverity CID 1568378 Signed-off-by: Peter Xu Reviewed-by: Alex Bennée --- tests/qtest/migration/tls-tests.c | 6 +++--- tests/unit/test-crypto-tlscredsx509.c | 4 ++-- tests/unit/test-crypto-tlssession.c | 6 +++--- tests/unit/test-io-channel-tls.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-tests.c index 5704a1f992..c78daff998 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -43,14 +43,14 @@ migrate_hook_start_tls_psk_common(QTestState *from, data->workdir = g_strdup_printf("%s/tlscredspsk0", tmpfs); data->pskfile = g_strdup_printf("%s/%s", data->workdir, QCRYPTO_TLS_CREDS_PSKFILE); - g_mkdir_with_parents(data->workdir, 0700); + qemu_mkdir_with_parents(data->workdir, 0700); test_tls_psk_init(data->pskfile); if (mismatch) { data->workdiralt = g_strdup_printf("%s/tlscredspskalt0", tmpfs); data->pskfilealt = g_strdup_printf("%s/%s", data->workdiralt, QCRYPTO_TLS_CREDS_PSKFILE); - g_mkdir_with_parents(data->workdiralt, 0700); + qemu_mkdir_with_parents(data->workdiralt, 0700); test_tls_psk_init_alt(data->pskfilealt); } @@ -152,7 +152,7 @@ migrate_hook_start_tls_x509_common(QTestState *from, data->clientcert = g_strdup_printf("%s/client-cert.pem", data->workdir); } - g_mkdir_with_parents(data->workdir, 0700); + qemu_mkdir_with_parents(data->workdir, 0700); test_tls_init(data->keyfile); #ifndef _WIN32 diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c index 3c25d75ca1..57ce0134df 100644 --- a/tests/unit/test-crypto-tlscredsx509.c +++ b/tests/unit/test-crypto-tlscredsx509.c @@ -75,7 +75,7 @@ static void test_tls_creds(const void *opaque) QCryptoTLSCreds *creds; #define CERT_DIR "tests/test-crypto-tlscredsx509-certs/" - g_mkdir_with_parents(CERT_DIR, 0700); + qemu_mkdir_with_parents(CERT_DIR, 0700); unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); if (data->isServer) { @@ -141,7 +141,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - g_mkdir_with_parents(WORKDIR, 0700); + qemu_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c index 3395f73560..db97cbefe7 100644 --- a/tests/unit/test-crypto-tlssession.c +++ b/tests/unit/test-crypto-tlssession.c @@ -271,8 +271,8 @@ static void test_crypto_tls_session_x509(const void *opaque) #define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/" #define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/" - g_mkdir_with_parents(CLIENT_CERT_DIR, 0700); - g_mkdir_with_parents(SERVER_CERT_DIR, 0700); + qemu_mkdir_with_parents(CLIENT_CERT_DIR, 0700); + qemu_mkdir_with_parents(SERVER_CERT_DIR, 0700); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT); @@ -420,7 +420,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - g_mkdir_with_parents(WORKDIR, 0700); + qemu_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); test_tls_psk_init(PSKFILE); diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c index e036ac5df4..6cb83e891a 100644 --- a/tests/unit/test-io-channel-tls.c +++ b/tests/unit/test-io-channel-tls.c @@ -125,8 +125,8 @@ static void test_io_channel_tls(const void *opaque) #define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/" #define SERVER_CERT_DIR "tests/test-io-channel-tls-server/" - g_mkdir_with_parents(CLIENT_CERT_DIR, 0700); - g_mkdir_with_parents(SERVER_CERT_DIR, 0700); + qemu_mkdir_with_parents(CLIENT_CERT_DIR, 0700); + qemu_mkdir_with_parents(SERVER_CERT_DIR, 0700); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT); @@ -273,7 +273,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - g_mkdir_with_parents(WORKDIR, 0700); + qemu_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); From patchwork Mon Dec 16 16:14:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13910011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C863E7717F for ; Mon, 16 Dec 2024 16:15:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNDkE-0007g1-7E; Mon, 16 Dec 2024 11:14:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDjl-0007Qs-OC for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNDjk-00075v-DG for qemu-devel@nongnu.org; Mon, 16 Dec 2024 11:14:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734365663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g/CnB5IoNrKWMuDTkN+UMJbePcwmIWh00AwU0aoHclg=; b=bd8k1oZArq9SFODIy+El+MEQAvKSXUv3H/uVY4+TB8/GwuyumGq9KMDsl5Cj5leK37gKGT 7fYC3HUfMZyiTFTj0oyzRO9cIwzGiSk+vQRHpBYWjNo6s+pvUmZlRj3SMEvHZp60zJiipk ib9XFQJM5GO1Jy4UK7mI9ONozYuuX4M= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-440-hukpzl-hNjW3j0xSKUmeMA-1; Mon, 16 Dec 2024 11:14:21 -0500 X-MC-Unique: hukpzl-hNjW3j0xSKUmeMA-1 X-Mimecast-MFC-AGG-ID: hukpzl-hNjW3j0xSKUmeMA Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3a9d195e6e5so44134315ab.2 for ; Mon, 16 Dec 2024 08:14:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734365660; x=1734970460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g/CnB5IoNrKWMuDTkN+UMJbePcwmIWh00AwU0aoHclg=; b=X54M6y/jq7cmttheAHzoNKwOTmkscPuX6ZXhBYdwwsNw245PvmlmeYdpdxUb0gsrH6 +730pUERhb4Ah57/oBUo/YsbSxAx3KI+yv6LBaZ4W2N+hIf24sgVdu09rFSKLGToZuf1 mVViiwtmBtZXXrDed31QCnxxDPbx4a+c0AKRnfNBvk3gBIkcq+pk407qNJBJS1n7grfh Q8cfkVLI4QSbEOtttQgnPcH37bCEFK6HdCKrr2WdWyXXdJz9oFF2KsYDd2HTUXDwoa+M Gw5yP2Yv6cRYEYgHEUl3UXWYEbPJ1qoZUvwoqk0+H/tYHnUEYmZpEjpppQnooT4YaBlC ezwA== X-Gm-Message-State: AOJu0Yz1bBc8f8WagYoiuSy+Np4MseQB7mDEWOiAJJVz8ouO2sGwjYfW UgNF6iF6MrPjVo5kKCAO71Ru+PD5K0Z9s4n7sJ8O7uXc7tN9F7yOYo2l/d8cQbckVGVWa+l/50G ybfMPVum06/jabLt2MtbPSC9BBl8dlnmrBMcVo2PXhOEzSNF9Zs1LAvSgUOd0gHFBL5oSETfH7L gz6uBXwjP6iP7WWJeeHIDpvpGyIpl8n/I7Cw== X-Gm-Gg: ASbGncvxagLMs2EhsTAcIq+e/Jfmrhaeze6euOqRnAYKxfGo07p+ouZfVoQNFBNyt6N 6ZbI/hVXsfthJ5KSel4MIR5pW1BTG7j4W0d5HyyrimQsGMtdL6Qmuo/K5ZlY0PsqgtuTSa3nN03 8iYkx8GZA3mVRMh9+c3paHBU6jmQkpgo55Bq1thoVH4xUSI3fgXDHZMu7vE+zWGOtKdifzc31vn nJayAJd6a8CoVYRoAsrLIU1idcdjxOZciqkkucSqbe/E/xvCvYiojTDg1XQI5lJh58+QCPBsXAa oU9vGtTNDbHfcIAQR9xH X-Received: by 2002:a05:6e02:1c4d:b0:3a7:7a68:44e2 with SMTP id e9e14a558f8ab-3aff243f5acmr123265365ab.15.1734365660536; Mon, 16 Dec 2024 08:14:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpdtPtt/n3cDmBJ/BANd5WmoQq9jHhGyKFGkNQUaETrosrZeDrpzjT3m11uiFrUcXySoFQ6A== X-Received: by 2002:a05:6e02:1c4d:b0:3a7:7a68:44e2 with SMTP id e9e14a558f8ab-3aff243f5acmr123265115ab.15.1734365660162; Mon, 16 Dec 2024 08:14:20 -0800 (PST) Received: from x1n.. (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3b248cb74fbsm15895765ab.34.2024.12.16.08.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 08:14:19 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Michael Roth , peterx@redhat.com, Fabiano Rosas , Konstantin Kostiuk Subject: [PATCH 3/3] tests/migration: Drop arch_[source|target] Date: Mon, 16 Dec 2024 11:14:13 -0500 Message-ID: <20241216161413.1644171-4-peterx@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241216161413.1644171-1-peterx@redhat.com> References: <20241216161413.1644171-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.13, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Coverity complained about them. These two variables are never used now after commit 832c732c5d ("migration-test: Create arch_opts"), and/or commit 34cc54fb35 ("tests/qtest/migration-test: Use custom asm bios for ppc64"). Resolves: Coverity CID 1568379 Resolves: Coverity CID 1568380 Signed-off-by: Peter Xu Reviewed-by: Alex Bennée --- tests/qtest/migration/framework.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c index a902936039..47ce07856e 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -197,8 +197,6 @@ static void cleanup(const char *filename) int migrate_start(QTestState **from, QTestState **to, const char *uri, MigrateStart *args) { - g_autofree gchar *arch_source = NULL; - g_autofree gchar *arch_target = NULL; /* options for source and target */ g_autofree gchar *arch_opts = NULL; g_autofree gchar *cmd_source = NULL; @@ -307,12 +305,11 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri, "-name source,debug-threads=on " "-m %s " "-serial file:%s/src_serial " - "%s %s %s %s %s", + "%s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_size, tmpfs, arch_opts ? arch_opts : "", - arch_source ? arch_source : "", shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "", ignore_stderr); @@ -329,12 +326,11 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri, "-m %s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s %s", + "%s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", - arch_target ? arch_target : "", shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "", ignore_stderr);