From 13a5079a32b4bbe08103c61961f221d82c864e65 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 31 Oct 2017 14:34:33 +0200 Subject: [PATCH] 8748 loader: ptblread() is broken with >512B sectors Reviewed by: Robert Mustacchi Approved by: Richard Lowe --- usr/src/boot/sys/boot/common/disk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr/src/boot/sys/boot/common/disk.c b/usr/src/boot/sys/boot/common/disk.c index ba727e2671..ca068d365d 100644 --- a/usr/src/boot/sys/boot/common/disk.c +++ b/usr/src/boot/sys/boot/common/disk.c @@ -87,6 +87,12 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset) od = (struct open_disk *)dev->d_opendata; /* + * The strategy function assumes the offset is in units of 512 byte + * sectors. For larger sector sizes, we need to adjust the offset to + * match the actual sector size. + */ + offset *= (od->sectorsize / 512); + /* * As the GPT backup partition is located at the end of the disk, * to avoid reading past disk end, flag bcache not to use RA. */ -- 2.11.4.GIT