summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2016-05-06 03:13:52 +0000
committeryasuoka <yasuoka@openbsd.org>2016-05-06 03:13:52 +0000
commite9af57974becdf847901b45dd87bc639e7129c02 (patch)
tree8308bf744f0c1c0677cbb31e82fa8f43a5a57efc
parentr1.10 of if_bnx.c effectively removed the limit on the number of segments in (diff)
downloadwireguard-openbsd-e9af57974becdf847901b45dd87bc639e7129c02.tar.xz
wireguard-openbsd-e9af57974becdf847901b45dd87bc639e7129c02.zip
Fix efiboot not to hang with a disk whose block size < 512.
Report and diff from Vegar Linge Haaland ok krw
-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 */