aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2023-03-04 09:11:39 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2023-03-04 09:11:39 +0000
commitd447088d998107dfff30c3ca801ff778a9030270 (patch)
treefbf3c8af5c5485963ae6856d142412ac595ca4d4
parent96a8c6aa375a33dba5a704ed91b7633b7416291a (diff)
downloadsrc-d447088d998107dfff30c3ca801ff778a9030270.tar.gz
src-d447088d998107dfff30c3ca801ff778a9030270.zip
linux(4): Improve linux_ifconf readability
Initialize max_len and full variables in a code block where they are used.
-rw-r--r--sys/compat/linux/linux_ioctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 27cf90b96a71..839c3a61d647 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -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;