linux(4): Improve linux_ifconf readability

Initialize max_len and full variables in a code block where
they are used.
This commit is contained in:
Dmitry Chagin 2023-03-04 12:11:39 +03:00
parent 96a8c6aa37
commit d447088d99

View File

@ -2185,8 +2185,6 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
error = copyin(uifc, &ifc, sizeof(ifc));
if (error != 0)
return (error);
full = 0;
cbs.max_len = maxphys - 1;
/* handle the 'request buffer size' case */
if (PTRIN(ifc.ifc_buf) == NULL) {
@ -2196,10 +2194,12 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
NET_EPOCH_EXIT(et);
return (copyout(&ifc, uifc, sizeof(ifc)));
}
if (ifc.ifc_len <= 0)
return (EINVAL);
full = 0;
cbs.max_len = maxphys - 1;
again:
if (ifc.ifc_len <= cbs.max_len) {
cbs.max_len = ifc.ifc_len;