From owner-svn-src-head@freebsd.org Fri Sep 22 07:29:28 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 298BDE1BF0D; Fri, 22 Sep 2017 07:29:28 +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 E6E2281BF2; Fri, 22 Sep 2017 07:29:27 +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 v8M7TQiQ001192; Fri, 22 Sep 2017 07:29:26 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8M7TQmO001190; Fri, 22 Sep 2017 07:29:26 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709220729.v8M7TQmO001190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 22 Sep 2017 07:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323905 - in head/sys/boot/efi: include loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys/boot/efi: include loader X-SVN-Commit-Revision: 323905 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, 22 Sep 2017 07:29:28 -0000 Author: tsoome Date: Fri Sep 22 07:29:26 2017 New Revision: 323905 URL: https://svnweb.freebsd.org/changeset/base/323905 Log: libefi: pdinfo_t pd_unit and pd_open should be unsigned The device index, partition index and reference counter are all positive numbers. However, since our internal partition number may be negative to indicate GPT table, the compare expression need to take care when comparing pdinfo_t and partition data. Modified: head/sys/boot/efi/include/efilib.h head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/include/efilib.h ============================================================================== --- head/sys/boot/efi/include/efilib.h Fri Sep 22 06:33:01 2017 (r323904) +++ head/sys/boot/efi/include/efilib.h Fri Sep 22 07:29:26 2017 (r323905) @@ -56,8 +56,8 @@ typedef struct pdinfo EFI_HANDLE pd_alias; EFI_DEVICE_PATH *pd_devpath; EFI_BLOCK_IO *pd_blkio; - int pd_unit; /* unit number */ - int pd_open; /* reference counter */ + uint32_t pd_unit; /* unit number */ + uint32_t pd_open; /* reference counter */ void *pd_bcache; /* buffer cache data */ } pdinfo_t; Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Fri Sep 22 06:33:01 2017 (r323904) +++ head/sys/boot/efi/loader/main.c Fri Sep 22 07:29:26 2017 (r323905) @@ -901,7 +901,7 @@ command_chain(int argc, char *argv[]) /* * d_partition should be 255 */ - if (pd->pd_unit == d_dev->d_slice) { + if (pd->pd_unit == (uint32_t)d_dev->d_slice) { loaded_image->DeviceHandle = pd->pd_handle; break;