Sanity check the return from the kernel.
We should be getting back as many bytes as we asked for, and we don't handle shortages at all, so just reject anything that's not right. Differential Revision: https://reviews.freebsd.org/D15629
This commit is contained in:
parent
3dfe152d8d
commit
92376fa76c
@ -220,6 +220,11 @@ devinfo_init_devices(int generation)
|
||||
warn("sysctl hw.bus.devices.%d", dev_idx);
|
||||
return(errno);
|
||||
}
|
||||
if (rlen != sizeof(udev)) {
|
||||
warnx("sysctl returned wrong data %zd bytes instead of %zd",
|
||||
rlen, sizeof(udev));
|
||||
return (EINVAL);
|
||||
}
|
||||
if ((dd = malloc(sizeof(*dd))) == NULL)
|
||||
return(ENOMEM);
|
||||
dd->dd_dev.dd_handle = udev.dv_handle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user