From nobody Mon Feb 26 12:58:24 2024 X-Original-To: dev-commits-src-all@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 4Tk0zP3d5Fz5BLCc; Mon, 26 Feb 2024 12:58:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tk0zP1WQgz41Kt; Mon, 26 Feb 2024 12:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708952305; 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=ulwfIzOfc9xn8XrHYq8UZ12fN8vv38fwmNyNYgTBWEM=; b=mGXMiqIhrDPb8FpbUVcNOrTmTI2AyIHycYJ4OVPDHyGPA6jkLVbNdwTrOe6F+nv7S5yQ55 b+p39UTcUghGXlv7ZxJcGc9Xxr/Nt6sl6pUiKowLggCiBiBKxaOyeRtZICrF/AVSZqaA5t YICEZ3Lz+oogy9S5Y0XUHWppCv427vRtBlGkwMYMMFilQWLP8v9csxnng+NDJPtWxHRsEK 9cq6oLBqg3R7kc3SCl7GZJzwQALREFYA1njnkicq8EYoMsadq2R3619xdmlyEBxM/rlTIw T5CtEm79q3D9kHmrC1Ka/uUYvOCV0DMuPaU0xMl7skR+LFCcjtOLZ6rBWKzYpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708952305; a=rsa-sha256; cv=none; b=f+rBC+4BoWz5wdjh6pKS1Owe+iVBWqVq3kp1qBI2VVD1ZiIbUscfZBmLOCs5PBIOJ4IPoz 2pxml1QIsdddBS2OGGcA+X58H+yXyPqRVvYC5fClv61S0KgTOCzcQKm9kX0O9Wigpsu3PD Gm7xgNtU96NXUcHEtsndPlX0eh0dwazEgI+MFCSDLyDcsq9CNYc4Qp20xgxWQa/NLKoqm5 9UukAhrZh5kU5H3FeuYwjU2hp7pzQRHkp2fgNfz0vciVtlG9suaeF5JW8eh187Vys1h44J SOWf8aslPMRm2hlRzl3jh1v5jO6CUkRWhbUvU3dZEkhqnQRCwBIvrKij2LU6pQ== 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=1708952305; 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=ulwfIzOfc9xn8XrHYq8UZ12fN8vv38fwmNyNYgTBWEM=; b=P0/sRDNn9f5LTPMrxM6mHEStgT7iWgf/r4dyK2Jt1IxhnLrwE9kUiCmklPUltiVnGcaoae 7RmUKrJjqSTRs7P01hwTFe/GDc5ZhYwtnX0H/320sbBKs3iLzldvpnporhx6cfjuiBYC9X /Vjkje7xqvFzdnr3JM2cJlKd5EMOHzDoy/nnO7jyZoSDDzEEVc9/ufTpDAbxx3OB9zM2xq mk73uxl4V7tJPcfx+XTZS94+8BLBJg/hNuVykEhjcuv1uGhmRdKMUHRGR5S3lNwRsVoRq1 VnB05XVa3WVkGOKnzHVfoVdqAJ8D0/0IZQRGOgYzSjOEsVidonlQtpQzppl0ow== 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 4Tk0zP0T38zT3d; Mon, 26 Feb 2024 12:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41QCwOfb050771; Mon, 26 Feb 2024 12:58:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41QCwOxD050768; Mon, 26 Feb 2024 12:58:24 GMT (envelope-from git) Date: Mon, 26 Feb 2024 12:58:24 GMT Message-Id: <202402261258.41QCwOxD050768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1b3f4ccb7dd8 - main - loader: we can only env_discard() existing variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b3f4ccb7dd8600d010fc6a09b09ee7d74872809 Auto-Submitted: auto-generated The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1b3f4ccb7dd8600d010fc6a09b09ee7d74872809 commit 1b3f4ccb7dd8600d010fc6a09b09ee7d74872809 Author: Toomas Soome AuthorDate: 2024-02-25 22:34:00 +0000 Commit: Toomas Soome CommitDate: 2024-02-26 12:56:52 +0000 loader: we can only env_discard() existing variable While dropping nvpair from nvstore, we also remove the corresponding environment variable. By doing so, we should be careful not to try to unset non-existing variable. Reviewed by: imp MFC after: 2 week Differential revision: https://reviews.freebsd.org/D44083 --- stand/libsa/zfs/zfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c index 3e7c698e650a..70a102f6425d 100644 --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -1264,8 +1264,12 @@ zfs_nvstore_unset_impl(void *vdev, const char *name, bool unset_env) rv = zfs_set_bootenv(vdev, spa->spa_bootenv); } - if (unset_env) - env_discard(env_getenv(name)); + if (unset_env) { + struct env_var *ev = env_getenv(name); + + if (ev != NULL) + env_discard(ev); + } return (rv); }