From nobody Sun Dec 14 06:21:58 2025 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=1629639178; cv=none; d=zohomail.com; s=zohoarc; b=blhQmbcyYbXE8zf6Zqvt3AcAHBoSwqQF9SVrMnZ8CE/U0tWf/tv+46TvODQ9TfbtaBhfB5p/anOHSyMi8jYYWw5I0nPckH1unIjDZ7r/8HSdhwRn76huQ5djW8xUFtm553EzN0Oc2HSiBMWw7rj5wMiRCzedoT3ePjLw4xWQTIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629639178; 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=5jKfd6sVikDt3oYLoGttLhQ8l3eB72EFDlpIpChG4sE=; b=VfCffW84FQlDD9ciQptLLLKL6LBfMa78VmS2YLIyAxHBtrCtbbhPbPxR8CLUq0Y+1g+1HxPzuxAJQne8UETeGTuETcK+/ZBtHoXMpku1mRPj5FL9qwvLaFNToe10Ikkv8vlil/5pCn83Hexuj2N+tAZ+sfcdGK7bitiJ3VbjMmU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629639178573629.6233355339264; Sun, 22 Aug 2021 06:32:58 -0700 (PDT) Received: from localhost ([::1]:34610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHnar-0006KQ-JW for importer@patchew.org; Sun, 22 Aug 2021 09:32:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <18150291edc827161bf631e1d4618ebcdf259da2@lizzy.crudebyte.com>) id 1mHnZ0-0003WS-Tf for qemu-devel@nongnu.org; Sun, 22 Aug 2021 09:31:03 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:55553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <18150291edc827161bf631e1d4618ebcdf259da2@lizzy.crudebyte.com>) id 1mHnYz-0001QH-9C for qemu-devel@nongnu.org; Sun, 22 Aug 2021 09:31:02 -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=5jKfd6sVikDt3oYLoGttLhQ8l3eB72EFDlpIpChG4sE=; b=M0JOl DqEfR+5iOwujrGq/4tKmqWmWGzWhhv47ZU+hr3geEuv54IxYNa47VLOaS+m+QJi6hOw0HthBNS5Cb mx6ia+cD8V5ugHxhqPF5Hu3XkcPFuDL20D6tXdu75Lr6I/blwiJtyqDFZOnidgbt3OIupKiGjxmG4 L1Qn4vj0yPl+Bo5xwYy4/XBHOtHEKl3tQE7bXRuWYPc8bj0x3OQFMaVmADLlJIpzmL5Cbk0zJvEFz WovJI6JQHIhJXrdDeb5VOIfjmXOx/DCH2WkXREFFbcZgTQ4JlnBjU5jvpvbwJHYiLV785uvDWZo3W gD81/DPufgVVxinSXxHuSaf0ae9zA==; Message-Id: <18150291edc827161bf631e1d4618ebcdf259da2.1629638507.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Sun, 22 Aug 2021 15:17:22 +0200 Subject: [PATCH v2 5/5] 9pfs: use QArray in v9fs_walk() To: qemu-devel@nongnu.org Cc: Greg Kurz , Richard Henderson 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=18150291edc827161bf631e1d4618ebcdf259da2@lizzy.crudebyte.com; helo=lizzy.crudebyte.com 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) X-ZM-MESSAGEID: 1629639180737100007 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Christian Schoenebeck --- hw/9pfs/9p.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index b59572fa79..91062ee4d6 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1707,13 +1707,14 @@ static void coroutine_fn v9fs_walk(void *opaque) int name_idx; g_autofree V9fsQID *qids =3D NULL; int i, err =3D 0; - V9fsPath dpath, path, *pathes =3D NULL; + V9fsPath dpath, path; + QArrayRef(V9fsPath) pathes =3D NULL; uint16_t nwnames; struct stat stbuf, fidst; g_autofree struct stat *stbufs =3D NULL; size_t offset =3D 7; int32_t fid, newfid; - V9fsString *wnames =3D NULL; + QArrayRef(V9fsString) wnames =3D NULL; V9fsFidState *fidp; V9fsFidState *newfidp =3D NULL; V9fsPDU *pdu =3D opaque; @@ -1734,10 +1735,10 @@ static void coroutine_fn v9fs_walk(void *opaque) goto out_nofid; } if (nwnames) { - wnames =3D g_new0(V9fsString, nwnames); + QARRAY_CREATE(V9fsString, wnames, nwnames); qids =3D g_new0(V9fsQID, nwnames); stbufs =3D g_new0(struct stat, nwnames); - pathes =3D g_new0(V9fsPath, nwnames); + QARRAY_CREATE(V9fsPath, pathes, nwnames); for (i =3D 0; i < nwnames; i++) { err =3D pdu_unmarshal(pdu, offset, "s", &wnames[i]); if (err < 0) { @@ -1869,14 +1870,6 @@ out: v9fs_path_free(&path); out_nofid: pdu_complete(pdu, err); - if (nwnames && nwnames <=3D P9_MAXWELEM) { - for (name_idx =3D 0; name_idx < nwnames; name_idx++) { - v9fs_string_free(&wnames[name_idx]); - v9fs_path_free(&pathes[name_idx]); - } - g_free(wnames); - g_free(pathes); - } } =20 static int32_t coroutine_fn get_iounit(V9fsPDU *pdu, V9fsPath *path) --=20 2.20.1