From nobody Tue Nov 25 18:17:32 2025 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 4dG9s862ttz6HZH1 for ; Tue, 25 Nov 2025 18:17:32 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dG9s82cvCz4141 for ; Tue, 25 Nov 2025 18:17:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jE8ygx3RbJMIhzSFJXpIlV6DPEDVuAHaR+aJYzzMvXs=; b=Jm+Iec/1yVLJbJIDrl5QbTxhHwu+/0evmZD1M7/kIU2Ox6yTAkOTTwq6IY3+BlCRgrBSJ7 rOT4d6FVIzy4zq056OQIP+W9I5G5ozwQuc4RXmcc6mPjiqdJtQDm+gmB8M+MwS7qVDLqfi GF6NsxJY80/tUf03bOmj6/AcZlMfGJiOJQ2TsWamkF7EM/gCZ2g09AxsuBJRRGFu45lySt 9JNZuzgshQoc7RWfVFKEOcWxU8Wn+88hyASh4k0mtVc82r8LAP3RtHIXCh/PQwNSLu2TZ+ a3xDY8vv4zDeqCc/PTpkOWZ0kilvLX8+7J+UnkoF/3YdMaKRjrO43DAxUmaXPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jE8ygx3RbJMIhzSFJXpIlV6DPEDVuAHaR+aJYzzMvXs=; b=Ky2LOLxjTpYZkmkCHonX6D37cBFB/SPV3LyjhFlvOkFgtF/k5GuaVoBD3hfdt/mt5ivs7w eSp2/xSAKDCNtB3XZHWVwjMWzlpOMOrljzkOfJreeJoR9mUKJHjRD2rII7qPM7K3tuiH2q dXWok2JbeZCXZIImT6mzX1lsPS0T+vsEu9Vx3xGblyyoTqE3k31RtA4Uo3QDY0qQVgpfUV g1l7/VUF4ue/t+MqSMyGuhk6jYS9UGno8vIKwxaWyn72rlpW8Y9OfUGomop0jDUS1cZfaN ObT/LtS6EzJSSJC2rHPh4NFqlRr+hLwdh3JQ5yM1EyB5x3mTzRy0ODWWLcZvfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764094652; a=rsa-sha256; cv=none; b=a+K+6wCWoTWOi9TcWF8xSRONEPPg4coCp3T4H6NRg967Qc4pVJn5jzfJlI6JNODNvSwPG8 rtqYSK4xwR6HXQZMDyXTw81+bA3YCFHvwkPO0yv5xOT+aKhKPvRK1B1VzrnHdrzxXtl1RY u9uictBjrbNcNOpXzNn9ShA20gouVL2E6JFXGNN3uDAL6acDTsaYopoAwSLf8MhVE75PtH UBF1QwkYSf8xx6JdV7ASnMJPhFGFjeZpcmcwG0MaVnqQ7SfTuBBa6piIi33zvfGpTHTZrK 8nc/hg+HYaJttQt9S5g2+wZa18tIvMN3qTfyOGER4QhbNKA74Z1NdHbceRhmoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dG9s827bsz1BPs for ; Tue, 25 Nov 2025 18:17:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id d8b8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 25 Nov 2025 18:17:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Jose Luis Duran From: Warner Losh Subject: git: fd606b629f91 - main - libefivar: Add a checking step 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: fd606b629f91560d4369ba8beda0a5ce763ee065 Auto-Submitted: auto-generated Date: Tue, 25 Nov 2025 18:17:32 +0000 Message-Id: <6925f2bc.d8b8.7643d317@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd606b629f91560d4369ba8beda0a5ce763ee065 commit fd606b629f91560d4369ba8beda0a5ce763ee065 Author: Jose Luis Duran AuthorDate: 2025-11-13 16:45:16 +0000 Commit: Warner Losh CommitDate: 2025-11-25 18:17:24 +0000 libefivar: Add a checking step Add a checking step in DevicePathUtilities.c to verify DevicePath. https://bugzilla.tianocore.org/show_bug.cgi?id=1372 v2: Remove ASSERT() and the redundant checking step. Update related description. Note that the link above no longer exists. The commit message was kept verbatim. An archived version of the bug report can be found at: https://web.archive.org/web/20240714192353/bugzilla.tianocore.org/show_bug.cgi?id=1372 Obtained from: https://github.com/tianocore/edk2/commit/fd02394228ee1dc2378cccfde6098c461f96dd42 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1894 --- lib/libefivar/uefi-dputil.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/libefivar/uefi-dputil.c b/lib/libefivar/uefi-dputil.c index 129b805ab650..89e049884558 100644 --- a/lib/libefivar/uefi-dputil.c +++ b/lib/libefivar/uefi-dputil.c @@ -37,7 +37,7 @@ /* * Taken from MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c - * hash 9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107 2018-Jun-28 + * hash fd02394228ee1dc2378cccfde6098c461f96dd42 2019-Jan-31 */ /** @file @@ -77,12 +77,13 @@ static CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLibEndDevicePath = { /** Determine whether a given device path is valid. - If DevicePath is NULL, then ASSERT(). @param DevicePath A pointer to a device path data structure. @param MaxSize The maximum size of the device path data structure. @retval TRUE DevicePath is valid. + @retval FALSE DevicePath is NULL. + @retval FALSE Maxsize is less than sizeof(EFI_DEVICE_PATH_PROTOCOL). @retval FALSE The length of any node Node in the DevicePath is less than sizeof (EFI_DEVICE_PATH_PROTOCOL). @retval FALSE If MaxSize is not zero, the size of the DevicePath @@ -101,19 +102,17 @@ IsDevicePathValid ( UINTN Size; UINTN NodeLength; - ASSERT (DevicePath != NULL); - - if (MaxSize == 0) { - MaxSize = MAX_UINTN; - } - // - // Validate the input size big enough to touch the first node. + //Validate the input whether exists and its size big enough to touch the first node // - if (MaxSize < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { + if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) { return FALSE; } + if (MaxSize == 0) { + MaxSize = MAX_UINTN; + } + for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) { NodeLength = DevicePathNodeLength (DevicePath); if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {