From owner-svn-src-head@freebsd.org Fri Nov 10 12:07:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61A56E6C3A3; Fri, 10 Nov 2017 12:07:58 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D56A70C63; Fri, 10 Nov 2017 12:07:58 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAAC7vpP067328; Fri, 10 Nov 2017 12:07:57 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAAC7voR067326; Fri, 10 Nov 2017 12:07:57 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201711101207.vAAC7voR067326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 10 Nov 2017 12:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325641 - in head/sys/boot/efi: include libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys/boot/efi: include libefi X-SVN-Commit-Revision: 325641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:07:58 -0000 Author: tsoome Date: Fri Nov 10 12:07:56 2017 New Revision: 325641 URL: https://svnweb.freebsd.org/changeset/base/325641 Log: loader.efi: efi_devpath_is_prefix should return bool efi_devpath_is_prefix() is currently returning values 0 or 1, which means it really should return bool. Additionally, use unsigned len, because we only get unsigned values from DevicePathNodeLength(). Modified: head/sys/boot/efi/include/efilib.h head/sys/boot/efi/libefi/devpath.c Modified: head/sys/boot/efi/include/efilib.h ============================================================================== --- head/sys/boot/efi/include/efilib.h Fri Nov 10 11:19:47 2017 (r325640) +++ head/sys/boot/efi/include/efilib.h Fri Nov 10 12:07:56 2017 (r325641) @@ -82,7 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *); bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); -int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); +bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); Modified: head/sys/boot/efi/libefi/devpath.c ============================================================================== --- head/sys/boot/efi/libefi/devpath.c Fri Nov 10 11:19:47 2017 (r325640) +++ head/sys/boot/efi/libefi/devpath.c Fri Nov 10 12:07:56 2017 (r325641) @@ -167,13 +167,13 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVIC return (true); } -int +bool efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path) { - int len; + size_t len; if (prefix == NULL || path == NULL) - return (0); + return (false); while (1) { if (IsDevicePathEnd(prefix)) @@ -181,17 +181,17 @@ efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEV if (DevicePathType(prefix) != DevicePathType(path) || DevicePathSubType(prefix) != DevicePathSubType(path)) - return (0); + return (false); len = DevicePathNodeLength(prefix); if (len != DevicePathNodeLength(path)) - return (0); + return (false); - if (memcmp(prefix, path, (size_t)len) != 0) - return (0); + if (memcmp(prefix, path, len) != 0) + return (false); prefix = NextDevicePathNode(prefix); path = NextDevicePathNode(path); } - return (1); + return (true); }