From nobody Fri Apr 11 14:04:04 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZYz1w4DMXz5s4Sj; Fri, 11 Apr 2025 14:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZYz1w2Rz3z43X2; Fri, 11 Apr 2025 14:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744380244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+rPszJRf/7/Xxv+GIbyByZ4dgmRU1WUankdjVXNvEqQ=; b=cRWfQEStww5Qj1bq69FFPn5yE7ECrTt2RYPP08I7u0zc0FNH+Z6oj0Zp54W2eX2qhgg4mY 5uPNsH3lN4wnCVNHPaV0Fusj/EKirKJc696CctG5z1oTELa/gfaSN3fHuQx9UPdZ95QL6j MJl9uQdhdaFDudgph4OOjxS7ZHITYvITxhpzsJeKvpOkNqb5kziNtorUrXQ6QMZ5Gp2YLI YPRBBCL5bqvZZM0V6Do9M7iGIX2R1eqPmVSgTV5Dko4HoKbF5YPDZd1cO+IUlUuZ+9Cwe3 C21s/lMb//xwH4/W3sXT59GeuUvS07/yBDrAmruRuUIGwdh97pLw8lKfmfsguA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744380244; a=rsa-sha256; cv=none; b=jI/euZWZYj0PJRXM6BlpfaAXkee6FDR0gUsGEfu3ifALvh7pU27EpSOhw/ghbNptJM04HK MTqiVLhlrY+XUV4WW/OxBI9EAysp3X/oEedHcdwlQMwgx8++KgvilBh1t3vBDEBGawoYcu iOOtMkw0KA1ru5MU+BWM8IB6LVwhBJqkGR/kx9WlJzECpTZIpBUKaytqmTAFZkeeAn7IqM r7k3S3nRAUAMA9D8JmGCi/sTfnoFT/obtMwg7CIWRI8N7FSbCAiadfmFJ6RufzCoNJSO8K XdPlYGjeb7XI7Os2L6RwnI0N73gktEgXzSgC+CwfT50b0GK/NP216GDZ31MfRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744380244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+rPszJRf/7/Xxv+GIbyByZ4dgmRU1WUankdjVXNvEqQ=; b=qY0Bn470pOiDHZtyxFiAJ1nSruVNpG8WZaxeOCVc+bCJCPuSp7bnrT2ZZ1G2OOObYF3BC3 OMjA5Xa7ZRIbTA1Y7w8QGT150ubq1O4fnBoFMLhdXtiXqLPEHl/UUtjipiEpOVx3UMfGH9 1tsjPnmOOzCiQTgC5aC1RGrGEGrV/jyZHp6Jw9gtzhgl0QcW7TZ9DpRLXUGVrQx99Lz4lJ oxWTG7MOqyTsfM7Sd+dH7cAkpuTH5HNKhFYmLcDPkl8BId15Wc2nAb/tNR2QPQcheFIApc HZzT0iJ3XfRAtt4sH+ZjT7m5/vSa25SqRwXk5TYXHdTvOdunVvZMpFpGL2RgpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZYz1w213qzc7n; Fri, 11 Apr 2025 14:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53BE4479053839; Fri, 11 Apr 2025 14:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53BE44n6053836; Fri, 11 Apr 2025 14:04:04 GMT (envelope-from git) Date: Fri, 11 Apr 2025 14:04:04 GMT Message-Id: <202504111404.53BE44n6053836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 30020689fb1e - main - ctld: Do not remove item from an nvlist while iterating it List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30020689fb1e5c9549e430bd23600c88e1257697 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=30020689fb1e5c9549e430bd23600c88e1257697 commit 30020689fb1e5c9549e430bd23600c88e1257697 Author: John Baldwin AuthorDate: 2025-04-11 14:02:48 +0000 Commit: John Baldwin CommitDate: 2025-04-11 14:02:48 +0000 ctld: Do not remove item from an nvlist while iterating it While here, make use of cnvlist_* to simplify this code. Fixes: d42a73fb6a85 ("ctld: Add a dedicated API between parse.y and the rest of the program") Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D49650 --- usr.sbin/ctld/kernel.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc index 9ddf22b9f4e0..0cd0eaff6c6f 100644 --- a/usr.sbin/ctld/kernel.cc +++ b/usr.sbin/ctld/kernel.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -635,12 +636,12 @@ retry_port: NULL) { if (strcmp(key, "file") == 0 || strcmp(key, "dev") == 0) { - cl->l_path = nvlist_take_string(lun->attr_list, - key); + cl->l_path = checked_strdup( + cnvlist_get_string(cookie)); continue; } nvlist_add_string(cl->l_options, key, - nvlist_get_string(lun->attr_list, key)); + cnvlist_get_string(cookie)); error = nvlist_error(cl->l_options); if (error != 0) log_warnc(error, "unable to add CTL lun option "