mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Reorder code to avoid the stat buffer being used uninitialized.
Obtained from: NetApp
This commit is contained in:
parent
078996e049
commit
ba02487a0e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247865
@ -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 New Issue
Block a user