From nobody Thu May 01 18:06:35 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 4ZpMSW6pMrz5vWcs; Thu, 01 May 2025 18:06:35 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZpMSW4fPzz4B7T; Thu, 01 May 2025 18:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746122795; 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=3bGCwspHBTPhRks9gnHweN1fREj6TqZm2jCa0L02ilM=; b=ZHaTXWWW6hfvHcbmcaoG0YSPppWW9BaI4TIaA2jHHhqbIG6dOB4PCxg7l4K8yz5VXIdeLe CKtKDNZMdPqfJVR5fQouGPOo0fRZSAQLGhVcTT5Kt0oFfRIYpevApjLoy5SBuOR5Jet3oR TqrfTQVRh6bjnWYWFy/VNBu7/fzvURwpUEiYMYNZZoVb3eWKv9U95KqXQS48Qee6qABmQ0 BKfcZ9dXm9/ybc3OcCo18IMf/JEVopimSkTYGeKCtTJaUZDpz1QNl/y0ySRiPtzP+PYNTk Dlsae5fRVWBnFNdWU0lapI1WZZWRlZ0bEv92NfFLILUK2RaSIylTat367HYYtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746122795; 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=3bGCwspHBTPhRks9gnHweN1fREj6TqZm2jCa0L02ilM=; b=wOBcthJGsVNZejfSMyWumHlL+G9hrpDAcibzuvqzXI5cxI1/w8LBFM7+ytxf4dIGxb92gs HPnkLiH6+SLXmPO3UZm+d/CYPnWxpxu5JkUVhbzFPU3uLUY3E8M4WZPqp8NpQDaO6k4DVk S3EFJEVe8f3vK140a3O59XHgO4VHDetMMFNsu3kZUuFsj2hsKxlY0TbCZ66J6I70jy62S2 LiTBaZZH+tT3/ymWlVdidlaQ1KtBJZc9l/GiKgQQvZH/ImM1wAcf9WSUT6kEAT7sq2LYia jeqACRRAIyUlDfYVb//BVfqbzdp9rvPv7uD5faAwO9bpZ2H7IGoc/SQ/z76J6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746122795; a=rsa-sha256; cv=none; b=i0xji686nhONhKsweT18roUhXgFmaxSVExWRsroy2LmmmG9ZRBVbY298sgLHAssH+MBAZi tHeD/N9kH+lKN1NhUplAB/ymwcuHB2cDBS6GAsgcCJak/S7JpOZqg6V/jCoYsQ6nHtJ4cw u2aKnDwJ0F6tJd2C8+Nv48TMa60fs3kbwWmMopNTGNROhQCY62ZQEiqU9o3W2PN2JpOGg/ /D2d9PYzDpDbaH7LIQaFk2s/NLA3Kj0ydYI9c+CMWPq5QkkD7COdlZYcyrzTGB89ihWHq6 /rXP/gj36nNhCzvhYdzVAIvR5Q4ENHXbRTtM+AtKHV0l3Jn3j4uJ5Paqe/ObeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4ZpMSW34CFzfhl; Thu, 01 May 2025 18:06:35 +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 541I6Zqx066460; Thu, 1 May 2025 18:06:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 541I6ZgG066457; Thu, 1 May 2025 18:06:35 GMT (envelope-from git) Date: Thu, 1 May 2025 18:06:35 GMT Message-Id: <202505011806.541I6ZgG066457@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: 3eb80ef831e1 - main - efivar: Use memcmp instead of uuid_ functions to compare 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: 3eb80ef831e1b82b38fc23bfe0114fc5f90e5c5f Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3eb80ef831e1b82b38fc23bfe0114fc5f90e5c5f commit 3eb80ef831e1b82b38fc23bfe0114fc5f90e5c5f Author: Warner Losh AuthorDate: 2025-05-01 17:52:59 +0000 Commit: Warner Losh CommitDate: 2025-05-01 17:52:59 +0000 efivar: Use memcmp instead of uuid_ functions to compare In these cases, memcmp is a perfectly fine substitute for the uuid functions. We don't need checking to make sure the uuids are good, we know the pointers are non-ULL, etc. memcmp will reduce the number of places we need to know these are actually UUIDs, or similar. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D50033 --- lib/libefivar/efivar.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/libefivar/efivar.c b/lib/libefivar/efivar.c index bb838e8a1399..a74deeae1e03 100644 --- a/lib/libefivar/efivar.c +++ b/lib/libefivar/efivar.c @@ -287,9 +287,7 @@ done: int efi_guid_cmp(const efi_guid_t *guid1, const efi_guid_t *guid2) { - uint32_t status; - - return uuid_compare((const uuid_t *)guid1, (const uuid_t *)guid2, &status); + return (memcmp(guid1, guid2, sizeof(*guid1))); } int @@ -304,11 +302,10 @@ int efi_guid_to_name(efi_guid_t *guid, char **name) { size_t i; - uint32_t status; efi_guid_tbl_compile(); for (i = 0; i < nitems(guid_tbl); i++) { - if (uuid_equal((const uuid_t *)guid, (const uuid_t *)&guid_tbl[i].guid, &status)) { + if (memcmp(guid, &guid_tbl[i].guid, sizeof(*guid)) == 0) { *name = strdup(guid_tbl[i].name); return (0); }