Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Mar 2023 09:12:51 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d447088d9981 - main - linux(4): Improve linux_ifconf readability
Message-ID:  <202303040912.3249Cpkt078983@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303040912.3249Cpkt078983>