git: 30ff1255fcd6 - main - Fix panic in nfs bootp/diskless after 0785c323f3.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 02 Jun 2023 16:57:34 UTC
The branch main has been updated by mav:

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

commit 30ff1255fcd6fc2cdb96924d3185dd7fa6c31c68
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2023-06-02 16:53:08 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2023-06-02 16:57:26 +0000

    Fix panic in nfs bootp/diskless after 0785c323f3.
    
    If there is no interface, count won't be initialized, while cnt is
    not even relevant. Check ifp, that really matters, and delete count.
---
 sys/nfs/nfs_diskless.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys/nfs/nfs_diskless.c b/sys/nfs/nfs_diskless.c
index 8f21861ab27e..001673f7a442 100644
--- a/sys/nfs/nfs_diskless.c
+++ b/sys/nfs/nfs_diskless.c
@@ -190,7 +190,6 @@ nfs_setup_diskless(void)
 	int cnt, fhlen, is_nfsv3;
 	uint32_t len;
 	time_t timeout_at;
-	u_int count;
 
 	if (nfs_diskless_valid != 0)
 		return;
@@ -238,20 +237,16 @@ nfs_setup_diskless(void)
 retry:
 	CURVNET_SET(TD_TO_VNET(curthread));
 	NET_EPOCH_ENTER(et);
-
 	for (ifp = if_iter_start(&iter); ifp != NULL; ifp = if_iter_next(&iter)) {
-		count = if_foreach_lladdr(ifp, nfs_setup_diskless_ifa_cb, &ourdl);
-
-		if (count > 0)
+		cnt = if_foreach_lladdr(ifp, nfs_setup_diskless_ifa_cb, &ourdl);
+		if (cnt > 0)
 			break;
-
 	}
 	if_iter_finish(&iter);
 	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
-	if (cnt > 0) {
+	if (ifp != NULL)
 		goto match_done;
-	}
 
 	if (time_uptime < timeout_at) {
 		pause("nfssdl", hz / 5);