svn commit: r331651 - head/sys/dev/sbni

Brooks Davis brooks at FreeBSD.org
Tue Mar 27 21:03:30 UTC 2018


Author: brooks
Date: Tue Mar 27 21:03:29 2018
New Revision: 331651
URL: https://svnweb.freebsd.org/changeset/base/331651

Log:
  Copy flags over ifr_union directly rather than via casts through ifr_data.
  
  No functional change in practice.  If the sbni driver supported
  64-bit big-endian system, this would be an ABI changes, but it is
  i386-only.  The old version leaked a word of stack on 64-bit systems.
  
  This eliminates the only assignment to ifr_data.

Modified:
  head/sys/dev/sbni/if_sbni.c

Modified: head/sys/dev/sbni/if_sbni.c
==============================================================================
--- head/sys/dev/sbni/if_sbni.c	Tue Mar 27 20:57:51 2018	(r331650)
+++ head/sys/dev/sbni/if_sbni.c	Tue Mar 27 21:03:29 2018	(r331651)
@@ -1144,7 +1144,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t 
 		flags.fixed_rxl = (sc->delta_rxl == 0);
 		flags.fixed_rate = 1;
 		SBNI_UNLOCK(sc);
-		ifr->ifr_data = *(caddr_t*) &flags;
+		bcopy(&flags, &ifr->ifr_ifru, sizeof(flags));
 		break;
 
 	case SIOCGINSTATS:
@@ -1163,7 +1163,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t 
 		error = priv_check(td, PRIV_DRIVER);
 		if (error)
 			break;
-		flags = *(struct sbni_flags*)&ifr->ifr_data;
+		bcopy(&ifr->ifr_ifru, &flags, sizeof(flags));
 		SBNI_LOCK(sc);
 		if (flags.fixed_rxl) {
 			sc->delta_rxl = 0;


More information about the svn-src-all mailing list