summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2016-05-06 03:13:53 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2016-05-06 03:13:53 +0000
commit62ba85c714f686c943420d4683da8b282a629e96 (patch)
tree901561139207e6ef30bc9d5ace6094d8cf694e48 /sys/arch/amd64
parented805419945cd4511c5ee0285db58d5af1f8dfc7 (diff)
Fix efiboot not to hang with a disk whose block size < 512.
Report and diff from Vegar Linge Haaland ok krw
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/stand/efiboot/efidev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c
index 64dde530543..b0cac089f14 100644
--- a/sys/arch/amd64/stand/efiboot/efidev.c
+++ b/sys/arch/amd64/stand/efiboot/efidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efidev.c,v 1.17 2016/05/01 10:43:05 krw Exp $ */
+/* $OpenBSD: efidev.c,v 1.18 2016/05/06 03:13:52 yasuoka Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -88,6 +88,9 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf)
/* block count of the intrisic block size in DEV_BSIZE */
blks = EFI_BLKSPERSEC(ed);
+ if (blks == 0)
+ /* block size < 512. HP Stream 13 actually has such a disk. */
+ return (EFI_UNSUPPORTED);
lba = off / blks;
/* leading and trailing unaligned blocks in intrisic block */