Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2018 13:03:06 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336170 - in head: sys/kern sys/netinet usr.bin/netstat usr.sbin/tcpdrop
Message-ID:  <201807101303.w6AD37gZ057013@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Tue Jul 10 13:03:06 2018
New Revision: 336170
URL: https://svnweb.freebsd.org/changeset/base/336170

Log:
  Use uintptr_t alone when assigning to kvaddr_t variables.
  
  Suggested by:	jhb

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/uipc_usrreq.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/sctp_sysctl.c
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/unix.c
  head/usr.sbin/tcpdrop/tcpdrop.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/sys/kern/kern_descrip.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -3362,10 +3362,10 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
 			if ((fp = fdp->fd_ofiles[n].fde_file) == NULL)
 				continue;
 			xf.xf_fd = n;
-			xf.xf_file = (kvaddr_t)(uintptr_t)fp;
-			xf.xf_data = (kvaddr_t)(uintptr_t)fp->f_data;
-			xf.xf_vnode = (kvaddr_t)(uintptr_t)fp->f_vnode;
-			xf.xf_type = (kvaddr_t)(uintptr_t)fp->f_type;
+			xf.xf_file = (uintptr_t)fp;
+			xf.xf_data = (uintptr_t)fp->f_data;
+			xf.xf_vnode = (uintptr_t)fp->f_vnode;
+			xf.xf_type = (uintptr_t)fp->f_type;
 			xf.xf_count = fp->f_count;
 			xf.xf_msgcount = 0;
 			xf.xf_offset = foffset_get(fp);

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/sys/kern/uipc_socket.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -3985,12 +3985,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
 {
 
 	xso->xso_len = sizeof *xso;
-	xso->xso_so = (kvaddr_t)(uintptr_t)so;
+	xso->xso_so = (uintptr_t)so;
 	xso->so_type = so->so_type;
 	xso->so_options = so->so_options;
 	xso->so_linger = so->so_linger;
 	xso->so_state = so->so_state;
-	xso->so_pcb = (kvaddr_t)(uintptr_t)so->so_pcb;
+	xso->so_pcb = (uintptr_t)so->so_pcb;
 	xso->xso_protocol = so->so_proto->pr_protocol;
 	xso->xso_family = so->so_proto->pr_domain->dom_family;
 	xso->so_timeo = so->so_timeo;

Modified: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/sys/kern/uipc_usrreq.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -1853,7 +1853,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS)
 
 		if (freeunp == 0 && unp->unp_gencnt <= gencnt) {
 			xu->xu_len = sizeof *xu;
-			xu->xu_unpp = (kvaddr_t)(uintptr_t)unp;
+			xu->xu_unpp = (uintptr_t)unp;
 			/*
 			 * XXX - need more locking here to protect against
 			 * connect/disconnect races for SMP.
@@ -1870,12 +1870,10 @@ unp_pcblist(SYSCTL_HANDLER_ARGS)
 				      unp->unp_conn->unp_addr->sun_len);
 			else
 				bzero(&xu->xu_caddr, sizeof(xu->xu_caddr));
-			xu->unp_vnode = (kvaddr_t)(uintptr_t)unp->unp_vnode;
-			xu->unp_conn = (kvaddr_t)(uintptr_t)unp->unp_conn;
-			xu->xu_firstref =
-			    (kvaddr_t)(uintptr_t)LIST_FIRST(&unp->unp_refs);
-			xu->xu_nextref =
-			    (kvaddr_t)(uintptr_t)LIST_NEXT(unp, unp_reflink);
+			xu->unp_vnode = (uintptr_t)unp->unp_vnode;
+			xu->unp_conn = (uintptr_t)unp->unp_conn;
+			xu->xu_firstref = (uintptr_t)LIST_FIRST(&unp->unp_refs);
+			xu->xu_nextref = (uintptr_t)LIST_NEXT(unp, unp_reflink);
 			xu->unp_gencnt = unp->unp_gencnt;
 			sotoxsocket(unp->unp_socket, &xu->xu_socket);
 			UNP_PCB_UNLOCK(unp);

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/sys/netinet/in_pcb.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -2906,7 +2906,7 @@ in_pcbtoxinpcb(const struct inpcb *inp, struct xinpcb 
 		bzero(&xi->xi_socket, sizeof(struct xsocket));
 	bcopy(&inp->inp_inc, &xi->inp_inc, sizeof(struct in_conninfo));
 	xi->inp_gencnt = inp->inp_gencnt;
-	xi->inp_ppcb = (kvaddr_t)(uintptr_t)inp->inp_ppcb;
+	xi->inp_ppcb = (uintptr_t)inp->inp_ppcb;
 	xi->inp_flow = inp->inp_flow;
 	xi->inp_flowid = inp->inp_flowid;
 	xi->inp_flowtype = inp->inp_flowtype;

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/sys/netinet/sctp_sysctl.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -409,7 +409,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
 		xinpcb.total_recvs = inp->total_recvs;
 		xinpcb.total_nospaces = inp->total_nospaces;
 		xinpcb.fragmentation_point = inp->sctp_frag_point;
-		xinpcb.socket = (kvaddr_t)(uintptr_t)inp->sctp_socket;
+		xinpcb.socket = (uintptr_t)inp->sctp_socket;
 		so = inp->sctp_socket;
 		if ((so == NULL) ||
 		    (!SCTP_IS_LISTENING(inp)) ||

Modified: head/usr.bin/netstat/inet.c
==============================================================================
--- head/usr.bin/netstat/inet.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/usr.bin/netstat/inet.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
 
 	bzero(xso, sizeof *xso);
 	xso->xso_len = sizeof *xso;
-	xso->xso_so = (kvaddr_t)(long)so;
+	xso->xso_so = (uintptr_t)so;
 	xso->so_type = so->so_type;
 	xso->so_options = so->so_options;
 	xso->so_linger = so->so_linger;
 	xso->so_state = so->so_state;
-	xso->so_pcb = (kvaddr_t)(long)so->so_pcb;
+	xso->so_pcb = (uintptr_t)so->so_pcb;
 	if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0)
 		return (-1);
 	xso->xso_protocol = proto.pr_protocol;

Modified: head/usr.bin/netstat/unix.c
==============================================================================
--- head/usr.bin/netstat/unix.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/usr.bin/netstat/unix.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -153,7 +153,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_lon
 	xu.xu_len = sizeof xu;
 	KREAD(head_off, &head, sizeof(head));
 	LIST_FOREACH(unp, &head, unp_link) {
-		xu.xu_unpp = (kvaddr_t)(long)unp;
+		xu.xu_unpp = (uintptr_t)unp;
 		KREAD(unp, &unp0, sizeof (*unp));
 		unp = &unp0;
 

Modified: head/usr.sbin/tcpdrop/tcpdrop.c
==============================================================================
--- head/usr.sbin/tcpdrop/tcpdrop.c	Tue Jul 10 11:33:37 2018	(r336169)
+++ head/usr.sbin/tcpdrop/tcpdrop.c	Tue Jul 10 13:03:06 2018	(r336170)
@@ -235,7 +235,7 @@ tcpdropall(const char *stack, int state)
 	head = getxpcblist("net.inet.tcp.pcblist");
 
 #define	XINP_NEXT(xinp)							\
-	((struct xinpgen *)(long)((uintptr_t)(xinp) + (xinp)->xig_len))
+	((struct xinpgen *)(uintptr_t)((uintptr_t)(xinp) + (xinp)->xig_len))
 
 	for (xinp = XINP_NEXT(head); xinp->xig_len > sizeof *xinp;
 	    xinp = XINP_NEXT(xinp)) {



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