summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bhyve/acpi.c')
-rw-r--r--usr.sbin/bhyve/acpi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
index 32effdc..cabe75e 100644
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -683,13 +683,16 @@ static int
basl_load(int fd, uint64_t off)
{
struct stat sb;
+ void *gaddr;
int err;
err = 0;
-
- if (fstat(fd, &sb) < 0 ||
- read(fd, paddr_guest2host(basl_acpi_base + off), sb.st_size) < 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;
return (err);
}
OpenPOWER on IntegriCloud