summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2024-06-30 12:03:18 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2024-06-30 12:03:18 +0000
commit5330958a6a75c4e075620848cdf3932c852ae2ad (patch)
treee108db3e06781835e86bf93b1278d87eae5653c9
parente4dc2aeb8d6e93c1683e7bb7d34c67111cb7cae5 (diff)
Use howmany() to calculate how many prpl entries are needed to describe a
hibernate i/o. Use of howmany() suggested by jmatthew@, ok jmatthew@
-rw-r--r--sys/dev/ic/nvme.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index fe8764b0323..62299a4de62 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.117 2024/06/04 20:31:35 krw Exp $ */
+/* $OpenBSD: nvme.c,v 1.118 2024/06/30 12:03:17 krw Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -1799,7 +1799,7 @@ nvme_hibernate_io(dev_t dev, daddr_t blkno, vaddr_t addr, size_t size,
page_bus_phys = page_phys;
htolem64(&isqe->entry.prp[1], page_bus_phys +
offsetof(struct nvme_hibernate_page, prpl));
- for (i = 1; i < (size / my->sc->sc_mps); i++) {
+ for (i = 1; i < howmany(size, my->sc->sc_mps); i++) {
htolem64(&my->prpl[i - 1], data_bus_phys +
(i * my->sc->sc_mps));
}