svn commit: r279254 - stable/10/sys/boot/amd64/boot1.efi
Ed Maste
emaste at FreeBSD.org
Tue Feb 24 22:11:08 UTC 2015
Author: emaste
Date: Tue Feb 24 22:11:07 2015
New Revision: 279254
URL: https://svnweb.freebsd.org/changeset/base/279254
Log:
MFC part of r273865: fix boot1.efi for block size != 512
r273865 is part of the work for supporting 4Kn drives, but it turns out
the underlying bug can actually cause corruption of the UEFI system
table in any case where block size is not 512.
Relevant portion of the original commit message:
convert boot1.efi to corrrectly calculate the lba for what the
media reports and convert the size based on what FreeBSD uses.
existing code would use the 512 byte lba and convert the
using 4K byte size.
PR: 197881
Reviewed by: Chris Ruffin
Modified:
stable/10/sys/boot/amd64/boot1.efi/boot1.c
Modified: stable/10/sys/boot/amd64/boot1.efi/boot1.c
==============================================================================
--- stable/10/sys/boot/amd64/boot1.efi/boot1.c Tue Feb 24 22:07:42 2015 (r279253)
+++ stable/10/sys/boot/amd64/boot1.efi/boot1.c Tue Feb 24 22:11:07 2015 (r279254)
@@ -168,9 +168,12 @@ static int
dskread(void *buf, u_int64_t lba, int nblk)
{
EFI_STATUS status;
+ int size;
+ lba = lba / (bootdev->Media->BlockSize / DEV_BSIZE);
+ size = nblk * DEV_BSIZE;
status = bootdev->ReadBlocks(bootdev, bootdev->Media->MediaId, lba,
- nblk * bootdev->Media->BlockSize, buf);
+ size, buf);
if (EFI_ERROR(status))
return (-1);
More information about the svn-src-stable-10
mailing list