diff options
Diffstat (limited to 'usr.sbin/bhyve/acpi.c')
-rw-r--r-- | usr.sbin/bhyve/acpi.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index cabe75e..f9504f8 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -687,12 +687,16 @@ basl_load(int fd, uint64_t off) int err; err = 0; - gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); - if (gaddr != NULL) { - if (fstat(fd, &sb) < 0 || read(fd, gaddr, sb.st_size) < 0) - err = errno; - } else - err = EFAULT; + if (fstat(fd, &sb) < 0) { + err = errno; + } else { + gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); + if (gaddr != NULL) { + if (read(fd, gaddr, sb.st_size) < 0) + err = errno; + } else + err = EFAULT; + } return (err); } |