summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjcs <jcs@openbsd.org>2017-05-12 22:16:54 +0000
committerjcs <jcs@openbsd.org>2017-05-12 22:16:54 +0000
commitdc8298f669ea2d7e18c8a8efea509eed200cb989 (patch)
treef418c14ea8c324e9358289c27c33fc86b54829a5 /sys
parentNo more CD-ROM releases, and advertise HTTP for (diff)
downloadwireguard-openbsd-dc8298f669ea2d7e18c8a8efea509eed200cb989.tar.xz
wireguard-openbsd-dc8298f669ea2d7e18c8a8efea509eed200cb989.zip
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')
-rw-r--r--sys/dev/ic/nvme.c8
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;