git: d447088d9981 - main - linux(4): Improve linux_ifconf readability

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Sat, 04 Mar 2023 09:12:51 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=d447088d998107dfff30c3ca801ff778a9030270

commit d447088d998107dfff30c3ca801ff778a9030270
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-03-04 09:11:39 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-03-04 09:11:39 +0000

    linux(4): Improve linux_ifconf readability
    
    Initialize max_len and full variables in a code block where
    they are used.
---
 sys/compat/linux/linux_ioctl.c | 6 +++---
 1 file 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;