stand: i386: take into account disk sector size for blk calculation
disk_blocks assumes BIOSDISK_SECSIZE, but the media may not be using it. In particular, bioscd on Parallels presents a 2K sector size, so we end up with a short disk_blocks and subsequent validation fails when trying to read /boot/lua. PR: 233098 Reviewed by: imp, tsoome MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36490
This commit is contained in:
parent
7d90ce7cae
commit
72291cee07
@ -1032,7 +1032,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
|
||||
d_offset = dev->d_offset;
|
||||
}
|
||||
if (disk_blocks == 0)
|
||||
disk_blocks = bd->bd_sectors - d_offset;
|
||||
disk_blocks = bd->bd_sectors * (bd->bd_sectorsize /
|
||||
BIOSDISK_SECSIZE) - d_offset;
|
||||
|
||||
/* Validate source block address. */
|
||||
if (dblk < d_offset || dblk >= d_offset + disk_blocks)
|
||||
|
Loading…
Reference in New Issue
Block a user