mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Reorder code to avoid the stat buffer being used uninitialized.
Obtained from: NetApp
This commit is contained in:
parent
078996e049
commit
ba02487a0e
1 changed files with 10 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue