diff options
author | Joshua Stein <jcs@cvs.openbsd.org> | 2017-05-12 22:16:55 +0000 |
---|---|---|
committer | Joshua Stein <jcs@cvs.openbsd.org> | 2017-05-12 22:16:55 +0000 |
commit | 706eee862994df02b9743a31d50aa49ad2a38626 (patch) | |
tree | 83bfd8e3108b147f60109193f438bf5375c24eab /sys/dev/ic | |
parent | a3a66a5333cb5f054383ea95424cc5da1c425457 (diff) |
subtract one sector from the disk size before passing it back to the
scsi layer, which will add one sector back
fixes incorrect disk size reporting which was causing fdisk to
create a protective MBR of one too many sectors, which caused our
EFI bootloader to fail to recognize it as a GPT disk
ok dlg
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/nvme.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 0785fbdadf5..3c4b48fd822 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.54 2017/04/08 02:57:25 deraadt Exp $ */ +/* $OpenBSD: nvme.c,v 1.55 2017/05/12 22:16:54 jcs Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -747,7 +747,8 @@ nvme_scsi_capacity16(struct scsi_xfer *xs) return; } - nsze = lemtoh64(&ns->nsze); + /* sd_read_cap_16() will add one */ + nsze = lemtoh64(&ns->nsze) - 1; f = &ns->lbaf[NVME_ID_NS_FLBAS(ns->flbas)]; memset(&rcd, 0, sizeof(rcd)); @@ -779,7 +780,8 @@ nvme_scsi_capacity(struct scsi_xfer *xs) return; } - nsze = lemtoh64(&ns->nsze); + /* sd_read_cap_10() will add one */ + nsze = lemtoh64(&ns->nsze) - 1; if (nsze > 0xffffffff) nsze = 0xffffffff; |