1
0
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:
Peter Grehan 2013-03-06 06:24:09 +00:00
parent 078996e049
commit ba02487a0e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247865

View File

@ -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);
}