From nobody Thu Feb 16 15:58:48 2023 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 4PHfkc33Vcz3r6lY; Thu, 16 Feb 2023 15:58:48 +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 4PHfkc2Ptlz3xQy; Thu, 16 Feb 2023 15:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676563128; 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=oRKtdN9y9oOg8SASwsPg51+2WDa0pzr0fnRaYxfX1Nk=; b=BPspSt70Sb6nphXF9PXQ3Ih1rIKRqQrAODwRieqCMUnaxNiaDVn9w1LtzHw2VqepBr2j3E HdWC3jzGG+WSisVAdvPvgZF785tsWgpQjIRQgs3H9bl0nnWCHuppJVSSz7Lz+yXZ0iH9Us ouEEEMNuQCo2va3F9EDQMugc4Y7zgho5Ht2BwSf1HFiek28SQDbngrHVogR1dBryZ6fFAg FX0ZVSNRUqRhPKtQtWdGaEka6ktXLPl+uUdy6LBkTqTYdUd1MuTF66XcZivxjXdIM7cTxO 0hy7yxU+ThAg+ZfFoywx5PNmwiGlW24jEjSNmNfh+6nhyGfsfRbQTaIbs/bnpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676563128; 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=oRKtdN9y9oOg8SASwsPg51+2WDa0pzr0fnRaYxfX1Nk=; b=C0jHAvUgM1EALryUzLQfmzr+Vj/LP0M2Q3PrF5fQoh1I4gB0Z6KoQWitvkd++N1Ui+2v+A JUXREtc2vaFHK38+pa1lhxUw86nMtpAHNAMOJ9K50UEBWgCN9bdrvxYfc5Kw5ZEISyV++V Ra5t5MOfqitBmrKAsU6KeG1S5+pRCjt+poNtQ1Vt8Fa2PdDE25gLy3/3b+t60QapXPp4NU Ge2JGIAcRnsRu0xmcnijI669mR8t6e0C3XAhMNMm8ZUL/n3jBnoKHT+SvPGMn6w8+tvCG/ TMK8gTOCyoIJvrtMer2i3nzMZN2+mNf6Kp5aD+OcbV/hg0YjR3shu+By9Jft8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676563128; a=rsa-sha256; cv=none; b=VUIg4vSfVA5XUFSUea6q0g4KXB0s6g1bEaoxo2IbvQdPIWyQkjkWxFkpgu7gif72bOL5aS oGNO8U681tNat89vVYVrt/PlR+7Qvp2uhPcJWldc5+3XUFpmXTLOknY4pfTdEqcwqy4FMZ to3Qm395K66YyPbwzOoC8ER2G5HZZPXIP1O2ABDiIJ6m0qf6EnkJpFoDfH9RJu1npwr9/0 FMzxk2cyq64W3ipEqOY3nfZNlCL4gLNq1C7+iEj1lPe6uLDR7y50Lvb+IaQ1X0B82IFwAk UQ+menLU1nXnR1XFUY/kj3sE3tHXIlcuTwXERBplV491aJd+CqJdmAZcWY2pnA== 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 4PHfkc1NCQz18Yn; Thu, 16 Feb 2023 15:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31GFwmOV099980; Thu, 16 Feb 2023 15:58:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31GFwmDk099979; Thu, 16 Feb 2023 15:58:48 GMT (envelope-from git) Date: Thu, 16 Feb 2023 15:58:48 GMT Message-Id: <202302161558.31GFwmDk099979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 49fd6affdbfe - main - efivar: Allow NULL paths in build_dp 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49fd6affdbfe6af53f119ebb27ff5e5e292e1f67 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=49fd6affdbfe6af53f119ebb27ff5e5e292e1f67 commit 49fd6affdbfe6af53f119ebb27ff5e5e292e1f67 Author: Warner Losh AuthorDate: 2023-02-16 15:53:26 +0000 Commit: Warner Losh CommitDate: 2023-02-16 15:54:39 +0000 efivar: Allow NULL paths in build_dp Allow there to be NULL paths in buildp. This lets us return the device path to the partition, as well as to files on the partition. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38615 --- lib/libefivar/efivar-dp-xlate.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index effc8a2de475..b6adae80fdb4 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -544,23 +544,25 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev) static int build_dp(const char *efimedia, const char *relpath, efidp *dp) { - char *fp, *dptxt = NULL, *cp, *rp; + char *fp = NULL, *dptxt = NULL, *cp, *rp = NULL; int rv = 0; efidp out = NULL; size_t len; - rp = strdup(relpath); - for (cp = rp; *cp; cp++) - if (*cp == '/') - *cp = '\\'; - fp = path_to_file_dp(rp); - free(rp); - if (fp == NULL) { - rv = ENOMEM; - goto errout; + if (relpath != NULL) { + rp = strdup(relpath); + for (cp = rp; *cp; cp++) + if (*cp == '/') + *cp = '\\'; + fp = path_to_file_dp(rp); + free(rp); + if (fp == NULL) { + rv = ENOMEM; + goto errout; + } } - asprintf(&dptxt, "%s/%s", efimedia, fp); + asprintf(&dptxt, "%s/%s", efimedia, fp == NULL ? "" : fp); out = malloc(8192); len = efidp_parse_device_path(dptxt, out, 8192); if (len > 8192) {