git: 4dcb33ebc80d - main - inetd: only declare and use the mapped-address netconfig under INET6
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 31 Aug 2026 18:17:22 UTC
The branch main has been updated by seuros:
URL: https://cgit.FreeBSD.org/src/commit/?id=4dcb33ebc80d83dfe231ea840d5c861a5ea41c98
commit 4dcb33ebc80d83dfe231ea840d5c861a5ea41c98
Author: Abdelkader Boudih <seuros@FreeBSD.org>
AuthorDate: 2026-08-31 18:15:45 +0000
Commit: Abdelkader Boudih <seuros@FreeBSD.org>
CommitDate: 2026-08-31 18:15:45 +0000
inetd: only declare and use the mapped-address netconfig under INET6
In a WITHOUT_INET6 build the only assignment to netid2 is compiled out and
the non-INET6 arm returns early, so netid2 is unconditionally NULL and the
rpcb_set() call guarded by it is dead code. clang does not prove it dead
and reports nbuf2 as uninitialized where it is passed as a const pointer,
No functional change.
MFC after: 1 week
Reported by: clang (-Wuninitialized-const-pointer)
Suggested by: dim
Approved by: ngie (co-mentor)
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D59277
---
usr.sbin/inetd/inetd.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 33316ce170a1..13302cf67b26 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1315,11 +1315,13 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
if (sep->se_rpc) {
u_int i;
socklen_t len = sep->se_ctrladdr_size;
- struct netconfig *netid, *netid2 = NULL;
+ struct netconfig *netid;
+ struct netbuf nbuf;
#ifdef INET6
+ struct netconfig *netid2 = NULL;
struct sockaddr_in sock;
+ struct netbuf nbuf2;
#endif
- struct netbuf nbuf, nbuf2;
if (getsockname(sep->se_fd,
(struct sockaddr*)&sep->se_ctrladdr, &len) < 0){
@@ -1360,10 +1362,12 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
for (i = sep->se_rpc_lowvers; i <= sep->se_rpc_highvers; i++) {
rpcb_unset(sep->se_rpc_prog, i, netid);
rpcb_set(sep->se_rpc_prog, i, netid, &nbuf);
+#ifdef INET6
if (netid2) {
rpcb_unset(sep->se_rpc_prog, i, netid2);
rpcb_set(sep->se_rpc_prog, i, netid2, &nbuf2);
}
+#endif
}
}
if (sep->se_socktype == SOCK_STREAM)