svn commit: r332288 - in stable/11/sys: dev/an dev/ath dev/cxgbe dev/de dev/en dev/fatm dev/hatm dev/if_ndis dev/iwi dev/ixgbe dev/ixl dev/mlx4/mlx4_en dev/mlx5/mlx5_en dev/mwl dev/nxge dev/oce dev...
Brooks Davis
brooks at FreeBSD.org
Sun Apr 8 16:54:11 UTC 2018
Author: brooks
Date: Sun Apr 8 16:54:07 2018
New Revision: 332288
URL: https://svnweb.freebsd.org/changeset/base/332288
Log:
MFC r331797:
Use an accessor function to access ifr_data.
This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).
Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14900
Modified:
stable/11/sys/dev/an/if_an.c
stable/11/sys/dev/ath/if_ath_ioctl.c
stable/11/sys/dev/cxgbe/t4_main.c
stable/11/sys/dev/de/if_de.c
stable/11/sys/dev/en/midway.c
stable/11/sys/dev/fatm/if_fatm.c
stable/11/sys/dev/hatm/if_hatm_ioctl.c
stable/11/sys/dev/if_ndis/if_ndis.c
stable/11/sys/dev/iwi/if_iwi.c
stable/11/sys/dev/ixgbe/if_ix.c
stable/11/sys/dev/ixl/ixl_pf_main.c
stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
stable/11/sys/dev/mwl/if_mwl.c
stable/11/sys/dev/nxge/if_nxge.c
stable/11/sys/dev/oce/oce_if.c
stable/11/sys/dev/patm/if_patm_ioctl.c
stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c
stable/11/sys/dev/sbni/if_sbni.c
stable/11/sys/dev/sfxge/sfxge.c
stable/11/sys/dev/vxge/vxge.c
stable/11/sys/dev/wl/if_wl.c
stable/11/sys/net/if.c
stable/11/sys/net/if.h
stable/11/sys/net/if_gif.c
stable/11/sys/net/if_gre.c
stable/11/sys/net/if_ipsec.c
stable/11/sys/net/if_spppsubr.c
stable/11/sys/net/if_var.h
stable/11/sys/net/if_vlan.c
stable/11/sys/net/iflib.c
stable/11/sys/net80211/ieee80211_ioctl.c
stable/11/sys/netinet/ip_carp.c
stable/11/sys/netpfil/pf/if_pfsync.c
stable/11/sys/security/mac/mac_net.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/an/if_an.c
==============================================================================
--- stable/11/sys/dev/an/if_an.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/an/if_an.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1932,7 +1932,8 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
error = 0;
break;
case SIOCGAIRONET:
- error = copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq));
+ error = copyin(ifr_data_get_ptr(ifr), &sc->areq,
+ sizeof(sc->areq));
if (error != 0)
break;
AN_LOCK(sc);
@@ -1961,13 +1962,15 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
break;
}
AN_UNLOCK(sc);
- error = copyout(&sc->areq, ifr->ifr_data, sizeof(sc->areq));
+ error = copyout(&sc->areq, ifr_data_get_ptr(ifr),
+ sizeof(sc->areq));
break;
case SIOCSAIRONET:
if ((error = priv_check(td, PRIV_DRIVER)))
goto out;
AN_LOCK(sc);
- error = copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq));
+ error = copyin(ifr_data_get_ptr(ifr), &sc->areq,
+ sizeof(sc->areq));
if (error != 0)
break;
an_setdef(sc, &sc->areq);
@@ -1976,7 +1979,8 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
case SIOCGPRIVATE_0: /* used by Cisco client utility */
if ((error = priv_check(td, PRIV_DRIVER)))
goto out;
- error = copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl));
+ error = copyin(ifr_data_get_ptr(ifr), &l_ioctl,
+ sizeof(l_ioctl));
if (error)
goto out;
mode = l_ioctl.command;
@@ -1994,13 +1998,15 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
AN_UNLOCK(sc);
if (!error) {
/* copy out the updated command info */
- error = copyout(&l_ioctl, ifr->ifr_data, sizeof(l_ioctl));
+ error = copyout(&l_ioctl, ifr_data_get_ptr(ifr),
+ sizeof(l_ioctl));
}
break;
case SIOCGPRIVATE_1: /* used by Cisco client utility */
if ((error = priv_check(td, PRIV_DRIVER)))
goto out;
- error = copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl));
+ error = copyin(ifr_data_get_ptr(ifr), &l_ioctl,
+ sizeof(l_ioctl));
if (error)
goto out;
l_ioctl.command = 0;
Modified: stable/11/sys/dev/ath/if_ath_ioctl.c
==============================================================================
--- stable/11/sys/dev/ath/if_ath_ioctl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/ath/if_ath_ioctl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -267,12 +267,12 @@ ath_ioctl(struct ieee80211com *ic, u_long cmd, void *d
rt->info[sc->sc_txrix].dot11Rate &~ IEEE80211_RATE_BASIC;
if (rt->info[sc->sc_txrix].phy & IEEE80211_T_HT)
sc->sc_stats.ast_tx_rate |= IEEE80211_RATE_MCS;
- return copyout(&sc->sc_stats,
- ifr->ifr_data, sizeof (sc->sc_stats));
+ return copyout(&sc->sc_stats, ifr_data_get_ptr(ifr),
+ sizeof (sc->sc_stats));
}
case SIOCGATHAGSTATS:
- return copyout(&sc->sc_aggr_stats,
- ifr->ifr_data, sizeof (sc->sc_aggr_stats));
+ return copyout(&sc->sc_aggr_stats, ifr_data_get_ptr(ifr),
+ sizeof (sc->sc_aggr_stats));
case SIOCZATHSTATS: {
int error;
Modified: stable/11/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/11/sys/dev/cxgbe/t4_main.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/cxgbe/t4_main.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1795,7 +1795,7 @@ fail:
case SIOCGI2C: {
struct ifi2creq i2c;
- rc = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ rc = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (rc != 0)
break;
if (i2c.dev_addr != 0xA0 && i2c.dev_addr != 0xA2) {
@@ -1813,7 +1813,7 @@ fail:
i2c.offset, i2c.len, &i2c.data[0]);
end_synchronized_op(sc, 0);
if (rc == 0)
- rc = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ rc = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
break;
}
Modified: stable/11/sys/dev/de/if_de.c
==============================================================================
--- stable/11/sys/dev/de/if_de.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/de/if_de.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -4266,7 +4266,7 @@ tulip_ifioctl(struct ifnet * ifp, u_long cmd, caddr_t
#ifdef SIOCGADDRROM
case SIOCGADDRROM: {
- error = copyout(sc->tulip_rombuf, ifr->ifr_data, sizeof(sc->tulip_rombuf));
+ error = copyout(sc->tulip_rombuf, ifr_data_get_ptr(ifr), sizeof(sc->tulip_rombuf));
break;
}
#endif
Modified: stable/11/sys/dev/en/midway.c
==============================================================================
--- stable/11/sys/dev/en/midway.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/en/midway.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1609,7 +1609,7 @@ en_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCATMGVCCS: /* return vcc table */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,
MID_N_VC, sc->vccs_open, &sc->en_mtx, 1);
- error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) +
+ error = copyout(vtab, ifr_data_get_ptr(ifr), sizeof(*vtab) +
vtab->count * sizeof(vtab->vccs[0]));
free(vtab, M_DEVBUF);
break;
Modified: stable/11/sys/dev/fatm/if_fatm.c
==============================================================================
--- stable/11/sys/dev/fatm/if_fatm.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/fatm/if_fatm.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2497,7 +2497,7 @@ fatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t arg)
/* return vcc table */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,
FORE_MAX_VCC + 1, sc->open_vccs, &sc->mtx, 1);
- error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) +
+ error = copyout(vtab, ifr_data_get_ptr(ifr), sizeof(*vtab) +
vtab->count * sizeof(vtab->vccs[0]));
free(vtab, M_DEVBUF);
break;
Modified: stable/11/sys/dev/hatm/if_hatm_ioctl.c
==============================================================================
--- stable/11/sys/dev/hatm/if_hatm_ioctl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/hatm/if_hatm_ioctl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -334,7 +334,7 @@ hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
/* return vcc table */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,
HE_MAX_VCCS, sc->open_vccs, &sc->mtx, 1);
- error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) +
+ error = copyout(vtab, ifr_data_get_ptr(ifr), sizeof(*vtab) +
vtab->count * sizeof(vtab->vccs[0]));
free(vtab, M_DEVBUF);
break;
Modified: stable/11/sys/dev/if_ndis/if_ndis.c
==============================================================================
--- stable/11/sys/dev/if_ndis/if_ndis.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/if_ndis/if_ndis.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2973,11 +2973,12 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd, v
switch (cmd) {
case SIOCGDRVSPEC:
case SIOCSDRVSPEC:
- error = copyin(ifr->ifr_data, &oid, sizeof(oid));
+ error = copyin(ifr_data_get_ptr(ifr), &oid, sizeof(oid));
if (error)
break;
oidbuf = malloc(oid.len, M_TEMP, M_WAITOK | M_ZERO);
- error = copyin(ifr->ifr_data + sizeof(oid), oidbuf, oid.len);
+ error = copyin((caddr_t)ifr_data_get_ptr(ifr) + sizeof(oid),
+ oidbuf, oid.len);
}
if (error) {
@@ -2999,7 +3000,7 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd, v
NDIS_UNLOCK(sc);
break;
}
- error = copyin(ifr->ifr_data, &evt, sizeof(evt));
+ error = copyin(ifr_data_get_ptr(ifr), &evt, sizeof(evt));
if (error) {
NDIS_UNLOCK(sc);
break;
@@ -3010,14 +3011,15 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd, v
break;
}
error = copyout(&sc->ndis_evt[sc->ndis_evtcidx],
- ifr->ifr_data, sizeof(uint32_t) * 2);
+ ifr_data_get_ptr(ifr), sizeof(uint32_t) * 2);
if (error) {
NDIS_UNLOCK(sc);
break;
}
if (sc->ndis_evt[sc->ndis_evtcidx].ne_len) {
error = copyout(sc->ndis_evt[sc->ndis_evtcidx].ne_buf,
- ifr->ifr_data + (sizeof(uint32_t) * 2),
+ (caddr_t)ifr_data_get_ptr(ifr) +
+ (sizeof(uint32_t) * 2),
sc->ndis_evt[sc->ndis_evtcidx].ne_len);
if (error) {
NDIS_UNLOCK(sc);
@@ -3039,10 +3041,11 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd, v
switch (cmd) {
case SIOCGDRVSPEC:
case SIOCSDRVSPEC:
- error = copyout(&oid, ifr->ifr_data, sizeof(oid));
+ error = copyout(&oid, ifr_data_get_ptr(ifr), sizeof(oid));
if (error)
break;
- error = copyout(oidbuf, ifr->ifr_data + sizeof(oid), oid.len);
+ error = copyout(oidbuf,
+ (caddr_t)ifr_data_get_ptr(ifr) + sizeof(oid), oid.len);
}
free(oidbuf, M_TEMP);
Modified: stable/11/sys/dev/iwi/if_iwi.c
==============================================================================
--- stable/11/sys/dev/iwi/if_iwi.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/iwi/if_iwi.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2057,7 +2057,7 @@ iwi_ioctl(struct ieee80211com *ic, u_long cmd, void *d
switch (cmd) {
case SIOCGIWISTATS:
/* XXX validate permissions/memory/etc? */
- error = copyout(&sc->sc_linkqual, ifr->ifr_data,
+ error = copyout(&sc->sc_linkqual, ifr_data_get_ptr(ifr),
sizeof(struct iwi_notif_link_quality));
break;
case SIOCZIWISTATS:
Modified: stable/11/sys/dev/ixgbe/if_ix.c
==============================================================================
--- stable/11/sys/dev/ixgbe/if_ix.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/ixgbe/if_ix.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -4826,7 +4826,7 @@ ixgbe_ioctl(struct ifnet *ifp, u_long command, caddr_t
int i;
IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)");
- error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error != 0)
break;
if (i2c.dev_addr != 0xA0 && i2c.dev_addr != 0xA2) {
@@ -4841,7 +4841,7 @@ ixgbe_ioctl(struct ifnet *ifp, u_long command, caddr_t
for (i = 0; i < i2c.len; i++)
hw->phy.ops.read_i2c_byte(hw, i2c.offset + i,
i2c.dev_addr, &i2c.data[i]);
- error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ error = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
break;
}
#endif
Modified: stable/11/sys/dev/ixl/ixl_pf_main.c
==============================================================================
--- stable/11/sys/dev/ixl/ixl_pf_main.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/ixl/ixl_pf_main.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -5173,7 +5173,7 @@ ixl_ioctl(struct ifnet * ifp, u_long command, caddr_t
if (!pf->has_i2c)
return (ENOTTY);
- error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error != 0)
break;
if (i2c.dev_addr != 0xA0 && i2c.dev_addr != 0xA2) {
@@ -5190,7 +5190,7 @@ ixl_ioctl(struct ifnet * ifp, u_long command, caddr_t
i2c.dev_addr, &i2c.data[i]))
return (EIO);
- error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ error = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
break;
}
#endif
Modified: stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2058,7 +2058,7 @@ out:
case SIOCGI2C: {
struct ifi2creq i2c;
- error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error)
break;
if (i2c.len > sizeof(i2c.data)) {
@@ -2075,7 +2075,7 @@ out:
error = -error;
break;
}
- error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ error = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
break;
}
#endif
Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2769,7 +2769,7 @@ out:
* Copy from the user-space address ifr_data to the
* kernel-space address i2c
*/
- error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error)
break;
@@ -2833,7 +2833,7 @@ out:
goto err_i2c;
}
- error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ error = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
err_i2c:
PRIV_UNLOCK(priv);
break;
Modified: stable/11/sys/dev/mwl/if_mwl.c
==============================================================================
--- stable/11/sys/dev/mwl/if_mwl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/mwl/if_mwl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -4744,8 +4744,8 @@ mwl_ioctl(struct ieee80211com *ic, u_long cmd, void *d
* statistics. The alternative is to copy the data
* to a local structure.
*/
- return (copyout(&sc->sc_stats,
- ifr->ifr_data, sizeof (sc->sc_stats)));
+ return (copyout(&sc->sc_stats, ifr_data_get_ptr(ifr),
+ sizeof (sc->sc_stats)));
#ifdef MWL_DIAGAPI
case SIOCGMVDIAG:
/* XXX check privs */
Modified: stable/11/sys/dev/nxge/if_nxge.c
==============================================================================
--- stable/11/sys/dev/nxge/if_nxge.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/nxge/if_nxge.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1366,7 +1366,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
void *info = NULL;
int retValue;
- cmd = retValue = fubyte(ifreqp->ifr_data);
+ cmd = retValue = fubyte(ifr_data_get_ptr(ifreqp));
if (retValue == -1)
return (EFAULT);
@@ -1378,7 +1378,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
(xge_hal_stats_hw_info_t **)&info);
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(info, ifreqp->ifr_data,
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_stats_hw_info_t)) == 0)
retValue = 0;
}
@@ -1396,7 +1396,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
sizeof(xge_hal_pci_config_t));
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(info, ifreqp->ifr_data,
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_pci_config_t)) == 0)
retValue = 0;
}
@@ -1416,7 +1416,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
sizeof(xge_hal_stats_device_info_t));
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(info, ifreqp->ifr_data,
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_stats_device_info_t)) == 0)
retValue = 0;
}
@@ -1437,7 +1437,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
sizeof(xge_hal_stats_sw_err_t));
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(info, ifreqp->ifr_data,
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_stats_sw_err_t)) == 0)
retValue = 0;
}
@@ -1450,7 +1450,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
break;
case XGE_QUERY_DRIVERSTATS:
- if(copyout(&lldev->driver_stats, ifreqp->ifr_data,
+ if(copyout(&lldev->driver_stats, ifr_data_get_ptr(ifreqp),
sizeof(xge_driver_stats_t)) == 0) {
retValue = 0;
}
@@ -1464,7 +1464,8 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
info = xge_os_malloc(NULL, XGE_BUFFER_SIZE);
if(info != NULL) {
strcpy(info, XGE_DRIVER_VERSION);
- if(copyout(info, ifreqp->ifr_data, XGE_BUFFER_SIZE) == 0)
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
+ XGE_BUFFER_SIZE) == 0)
retValue = 0;
xge_os_free(NULL, info, XGE_BUFFER_SIZE);
}
@@ -1478,7 +1479,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
sizeof(xge_hal_device_config_t));
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(info, ifreqp->ifr_data,
+ if(copyout(info, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_device_config_t)) == 0)
retValue = 0;
}
@@ -1491,7 +1492,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
break;
case XGE_QUERY_BUFFER_MODE:
- if(copyout(&lldev->buffer_mode, ifreqp->ifr_data,
+ if(copyout(&lldev->buffer_mode, ifr_data_get_ptr(ifreqp),
sizeof(int)) == 0)
retValue = 0;
break;
@@ -1500,7 +1501,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
case XGE_SET_BUFFER_MODE_2:
case XGE_SET_BUFFER_MODE_5:
mode = (cmd == XGE_SET_BUFFER_MODE_1) ? 'Y':'N';
- if(copyout(&mode, ifreqp->ifr_data, sizeof(mode)) == 0)
+ if(copyout(&mode, ifr_data_get_ptr(ifreqp), sizeof(mode)) == 0)
retValue = 0;
break;
default:
@@ -1528,7 +1529,7 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
int error;
u64 val64 = 0;
- error = copyin(ifreqp->ifr_data, &tmpdata, sizeof(tmpdata));
+ error = copyin(ifr_data_get_ptr(ifreqp), &tmpdata, sizeof(tmpdata));
if (error != 0)
return (error);
data = &tmpdata;
@@ -1541,7 +1542,8 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
&data->value);
mtx_unlock(&lldev->mtx_drv);
if(status == XGE_HAL_OK) {
- if(copyout(data, ifreqp->ifr_data, sizeof(xge_register_t)) == 0)
+ if(copyout(data, ifr_data_get_ptr(ifreqp),
+ sizeof(xge_register_t)) == 0)
retValue = 0;
}
}
@@ -1586,7 +1588,7 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
mtx_unlock(&lldev->mtx_drv);
if(retValue == 0) {
- if(copyout(data, ifreqp->ifr_data,
+ if(copyout(data, ifr_data_get_ptr(ifreqp),
sizeof(xge_hal_pci_bar0_t)) != 0) {
xge_trace(XGE_ERR, "Copyout of register values failed");
retValue = EINVAL;
Modified: stable/11/sys/dev/oce/oce_if.c
==============================================================================
--- stable/11/sys/dev/oce/oce_if.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/oce/oce_if.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1832,7 +1832,7 @@ oce_handle_passthrough(struct ifnet *ifp, caddr_t data
struct ifreq *ifr = (struct ifreq *)data;
int rc = ENXIO;
char cookie[32] = {0};
- void *priv_data = (void *)ifr->ifr_data;
+ void *priv_data = ifr_data_get_ptr(ifr);
void *ioctl_ptr;
uint32_t req_size;
struct mbx_hdr req;
Modified: stable/11/sys/dev/patm/if_patm_ioctl.c
==============================================================================
--- stable/11/sys/dev/patm/if_patm_ioctl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/patm/if_patm_ioctl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -387,7 +387,7 @@ patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
/* return vcc table */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,
sc->mmap->max_conn, sc->vccs_open, &sc->mtx, 1);
- error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) +
+ error = copyout(vtab, ifr_data_get_ptr(ifr), sizeof(*vtab) +
vtab->count * sizeof(vtab->vccs[0]));
free(vtab, M_DEVBUF);
break;
Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c
==============================================================================
--- stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2464,7 +2464,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
struct ecore_hwfn *p_hwfn = &ha->cdev.hwfns[0];
struct ecore_ptt *p_ptt;
- ret = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ ret = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (ret)
break;
@@ -2494,7 +2494,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
break;
}
- ret = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ ret = copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
QL_DPRINT8(ha, "SIOCGI2C copyout ret = %d \
len = %d addr = 0x%02x offset = 0x%04x \
Modified: stable/11/sys/dev/sbni/if_sbni.c
==============================================================================
--- stable/11/sys/dev/sbni/if_sbni.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/sbni/if_sbni.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1153,7 +1153,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t
SBNI_LOCK(sc);
bcopy(&sc->in_stats, in_stats, sizeof(struct sbni_in_stats));
SBNI_UNLOCK(sc);
- error = copyout(ifr->ifr_data, in_stats,
+ error = copyout(ifr_data_get_ptr(ifr), in_stats,
sizeof(struct sbni_in_stats));
free(in_stats, M_DEVBUF);
break;
Modified: stable/11/sys/dev/sfxge/sfxge.c
==============================================================================
--- stable/11/sys/dev/sfxge/sfxge.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/sfxge/sfxge.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -527,7 +527,7 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
{
struct ifi2creq i2c;
- error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error != 0)
break;
@@ -542,7 +542,8 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
&i2c.data[0]);
SFXGE_ADAPTER_UNLOCK(sc);
if (error == 0)
- error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ error = copyout(&i2c, ifr_data_get_ptr(ifr),
+ sizeof(i2c));
break;
}
#endif
@@ -550,12 +551,13 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
error = priv_check(curthread, PRIV_DRIVER);
if (error != 0)
break;
- error = copyin(ifr->ifr_data, &ioc, sizeof(ioc));
+ error = copyin(ifr_data_get_ptr(ifr), &ioc, sizeof(ioc));
if (error != 0)
return (error);
error = sfxge_private_ioctl(sc, &ioc);
if (error == 0) {
- error = copyout(&ioc, ifr->ifr_data, sizeof(ioc));
+ error = copyout(&ioc, ifr_data_get_ptr(ifr),
+ sizeof(ioc));
}
break;
default:
Modified: stable/11/sys/dev/vxge/vxge.c
==============================================================================
--- stable/11/sys/dev/vxge/vxge.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/vxge/vxge.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -3708,8 +3708,8 @@ vxge_ioctl_regs(vxge_dev_t *vdev, struct ifreq *ifr)
u32 offset, reqd_size = 0;
int i, err = EINVAL;
- char *command = (char *) ifr->ifr_data;
- void *reg_info = (void *) ifr->ifr_data;
+ char *command = ifr_data_get_ptr(ifr);
+ void *reg_info = ifr_data_get_ptr(ifr);
vxge_vpath_t *vpath;
vxge_hal_status_e status = VXGE_HAL_OK;
@@ -3816,7 +3816,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
vxge_drv_stats_t *drv_stat;
char *buffer = NULL;
- char *command = (char *) ifr->ifr_data;
+ char *command = ifr_data_get_ptr(ifr);
vxge_hal_status_e status = VXGE_HAL_OK;
switch (*command) {
@@ -3827,7 +3827,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
status = vxge_hal_aux_pci_config_read(vdev->devh,
bufsize, buffer, &retsize);
if (status == VXGE_HAL_OK)
- err = copyout(buffer, ifr->ifr_data, retsize);
+ err = copyout(buffer, ifr_data_get_ptr(ifr),
+ retsize);
else
device_printf(vdev->ndev,
"failed pciconfig statistics query\n");
@@ -3846,7 +3847,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
status = vxge_hal_aux_stats_mrpcim_read(vdev->devh,
bufsize, buffer, &retsize);
if (status == VXGE_HAL_OK)
- err = copyout(buffer, ifr->ifr_data, retsize);
+ err = copyout(buffer, ifr_data_get_ptr(ifr),
+ retsize);
else
device_printf(vdev->ndev,
"failed mrpcim statistics query\n");
@@ -3862,7 +3864,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
status = vxge_hal_aux_stats_device_read(vdev->devh,
bufsize, buffer, &retsize);
if (status == VXGE_HAL_OK)
- err = copyout(buffer, ifr->ifr_data, retsize);
+ err = copyout(buffer, ifr_data_get_ptr(ifr),
+ retsize);
else
device_printf(vdev->ndev,
"failed device statistics query\n");
@@ -3886,7 +3889,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
((vxge_device_hw_info_t *) buffer)->port_failure =
vdev->port_failure;
- err = copyout(buffer, ifr->ifr_data, bufsize);
+ err = copyout(buffer, ifr_data_get_ptr(ifr), bufsize);
if (err != 0)
device_printf(vdev->ndev,
"failed device hardware info query\n");
@@ -3913,7 +3916,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
sizeof(vxge_drv_stats_t));
}
- err = copyout(drv_stat, ifr->ifr_data, bufsize);
+ err = copyout(drv_stat, ifr_data_get_ptr(ifr), bufsize);
if (err != 0)
device_printf(vdev->ndev,
"failed driver statistics query\n");
@@ -3923,7 +3926,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
break;
case VXGE_GET_BANDWIDTH:
- bw_info = (vxge_bw_info_t *) ifr->ifr_data;
+ bw_info = ifr_data_get_ptr(ifr);
if ((vdev->config.hw_info.func_id != 0) &&
(vdev->hw_fw_version < VXGE_FW_VERSION(1, 8, 0)))
@@ -3936,7 +3939,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
if (status != VXGE_HAL_OK)
break;
- err = copyout(bw_info, ifr->ifr_data, sizeof(vxge_bw_info_t));
+ err = copyout(bw_info, ifr_data_get_ptr(ifr),
+ sizeof(vxge_bw_info_t));
break;
case VXGE_SET_BANDWIDTH:
@@ -3947,7 +3951,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
case VXGE_SET_PORT_MODE:
if (vdev->is_privilaged) {
if (vdev->config.hw_info.ports == VXGE_DUAL_PORT_MODE) {
- port_info = (vxge_port_info_t *) ifr->ifr_data;
+ port_info = ifr_data_get_ptr(ifr);
vdev->config.port_mode = port_info->port_mode;
err = vxge_port_mode_update(vdev);
if (err != ENXIO)
@@ -3964,10 +3968,11 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
case VXGE_GET_PORT_MODE:
if (vdev->is_privilaged) {
if (vdev->config.hw_info.ports == VXGE_DUAL_PORT_MODE) {
- port_info = (vxge_port_info_t *) ifr->ifr_data;
+ port_info = ifr_data_get_ptr(ifr);
err = vxge_port_mode_get(vdev, port_info);
if (err == VXGE_HAL_OK) {
- err = copyout(port_info, ifr->ifr_data,
+ err = copyout(port_info,
+ ifr_data_get_ptr(ifr),
sizeof(vxge_port_info_t));
}
}
@@ -4003,7 +4008,7 @@ vxge_bw_priority_set(vxge_dev_t *vdev, struct ifreq *i
u32 func_id;
vxge_bw_info_t *bw_info;
- bw_info = (vxge_bw_info_t *) ifr->ifr_data;
+ bw_info = ifr_data_get_ptr(ifr);
func_id = bw_info->func_id;
vdev->config.bw_info[func_id].priority = bw_info->priority;
Modified: stable/11/sys/dev/wl/if_wl.c
==============================================================================
--- stable/11/sys/dev/wl/if_wl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/dev/wl/if_wl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1313,7 +1313,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
WL_UNLOCK(sc);
- error = copyout(psa_buf, ifr->ifr_data, sizeof(psa_buf));
+ error = copyout(psa_buf, ifr_data_get_ptr(ifr), sizeof(psa_buf));
break;
@@ -1323,7 +1323,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((error = priv_check(td, PRIV_DRIVER)))
break;
- error = copyin(ifr->ifr_data, psa_buf, sizeof(psa_buf));
+ error = copyin(ifr_data_get_ptr(ifr), psa_buf, sizeof(psa_buf));
if (error)
break;
@@ -1357,7 +1357,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* get the current NWID out of the sc since we stored it there */
case SIOCGWLCNWID:
WL_LOCK(sc);
- ifr->ifr_data = (caddr_t) (sc->nwid[0] << 8 | sc->nwid[1]);
+ ifr_data_get_ptr(ifr) = (caddr_t) (sc->nwid[0] << 8 | sc->nwid[1]);
WL_UNLOCK(sc);
break;
@@ -1382,8 +1382,8 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/*
* soft c nwid shadows radio modem setting
*/
- sc->nwid[0] = (int)ifr->ifr_data >> 8;
- sc->nwid[1] = (int)ifr->ifr_data & 0xff;
+ sc->nwid[0] = (int)ifr_data_get_ptr(ifr) >> 8;
+ sc->nwid[1] = (int)ifr_data_get_ptr(ifr) & 0xff;
MMC_WRITE(MMC_NETW_ID_L,sc->nwid[1]);
MMC_WRITE(MMC_NETW_ID_H,sc->nwid[0]);
}
@@ -1409,7 +1409,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
wlmmcread(sc, MMC_EEDATALrv); /* 2.4 Gz: EEPROM word */
}
WL_UNLOCK(sc);
- error = copyout(ifr->ifr_data, eeprom_buf, sizeof(eeprom_buf));
+ error = copyout(ifr_data_get_ptr(ifr), eeprom_buf, sizeof(eeprom_buf));
break;
#ifdef WLCACHE
@@ -1426,7 +1426,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* read out the number of used cache elements */
case SIOCGWLCITEM:
WL_LOCK(sc);
- ifr->ifr_data = (caddr_t) sc->w_sigitems;
+ ifr_data_get_ptr(ifr) = (caddr_t) sc->w_sigitems;
WL_UNLOCK(sc);
break;
@@ -1443,7 +1443,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
bcopy(sc->w_sigcache, cpt, size);
WL_UNLOCK(sc);
- error = copyout(cpt, ifr->ifr_data, size);
+ error = copyout(cpt, ifr_data_get_ptr(ifr), size);
free(cpt, M_DEVBUF);
break;
#endif
Modified: stable/11/sys/net/if.c
==============================================================================
--- stable/11/sys/net/if.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -2400,6 +2400,20 @@ ifr_buffer_set_length(void *data, size_t len)
ifrup->ifr.ifr_ifru.ifru_buffer.length = len;
}
+void *
+ifr_data_get_ptr(void *ifrp)
+{
+ union ifreq_union *ifrup;
+
+ ifrup = ifrp;
+#ifdef COMPAT_FREEBSD32
+ if (SV_CURPROC_FLAG(SV_ILP32))
+ return ((void *)(uintptr_t)
+ ifrup->ifr32.ifr_ifru.ifru_data);
+#endif
+ return (ifrup->ifr.ifr_ifru.ifru_data);
+}
+
/*
* Hardware specific interface ioctls.
*/
@@ -2581,7 +2595,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data,
error = priv_check(td, PRIV_NET_SETIFNAME);
if (error)
return (error);
- error = copyinstr(ifr->ifr_data, new_name, IFNAMSIZ, NULL);
+ error = copyinstr(ifr_data_get_ptr(ifr), new_name, IFNAMSIZ,
+ NULL);
if (error != 0)
return (error);
if (new_name[0] == '\0')
@@ -2896,8 +2911,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, s
error = priv_check(td, PRIV_NET_IFCREATE);
if (error == 0)
error = if_clone_create(ifr->ifr_name,
- sizeof(ifr->ifr_name),
- cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL);
+ sizeof(ifr->ifr_name), cmd == SIOCIFCREATE2 ?
+ ifr_data_get_ptr(ifr) : NULL);
CURVNET_RESTORE();
return (error);
case SIOCIFDESTROY:
Modified: stable/11/sys/net/if.h
==============================================================================
--- stable/11/sys/net/if.h Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if.h Sun Apr 8 16:54:07 2018 (r332288)
@@ -408,7 +408,9 @@ struct ifreq {
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
#define ifr_media ifr_ifru.ifru_media /* physical media */
+#ifndef _KERNEL
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
+#endif
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
#define ifr_index ifr_ifru.ifru_index /* interface index */
Modified: stable/11/sys/net/if_gif.c
==============================================================================
--- stable/11/sys/net/if_gif.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_gif.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -906,12 +906,14 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case GIFGOPTS:
options = sc->gif_options;
- error = copyout(&options, ifr->ifr_data, sizeof(options));
+ error = copyout(&options, ifr_data_get_ptr(ifr),
+ sizeof(options));
break;
case GIFSOPTS:
if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0)
break;
- error = copyin(ifr->ifr_data, &options, sizeof(options));
+ error = copyin(ifr_data_get_ptr(ifr), &options,
+ sizeof(options));
if (error)
break;
if (options & ~GIF_OPTMASK)
Modified: stable/11/sys/net/if_gre.c
==============================================================================
--- stable/11/sys/net/if_gre.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_gre.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -453,7 +453,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case GRESKEY:
if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
break;
- if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
+ if ((error = copyin(ifr_data_get_ptr(ifr), &opt,
+ sizeof(opt))) != 0)
break;
if (sc->gre_key != opt) {
GRE_WLOCK(sc);
@@ -463,13 +464,14 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
break;
case GREGKEY:
- error = copyout(&sc->gre_key, ifr->ifr_data,
+ error = copyout(&sc->gre_key, ifr_data_get_ptr(ifr),
sizeof(sc->gre_key));
break;
case GRESOPTS:
if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
break;
- if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
+ if ((error = copyin(ifr_data_get_ptr(ifr), &opt,
+ sizeof(opt))) != 0)
break;
if (opt & ~GRE_OPTMASK)
error = EINVAL;
@@ -484,7 +486,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case GREGOPTS:
- error = copyout(&sc->gre_options, ifr->ifr_data,
+ error = copyout(&sc->gre_options, ifr_data_get_ptr(ifr),
sizeof(sc->gre_options));
break;
default:
Modified: stable/11/sys/net/if_ipsec.c
==============================================================================
--- stable/11/sys/net/if_ipsec.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_ipsec.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -688,12 +688,12 @@ ipsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
break;
case IPSECGREQID:
reqid = sc->reqid;
- error = copyout(&reqid, ifr->ifr_data, sizeof(reqid));
+ error = copyout(&reqid, ifr_data_get_ptr(ifr), sizeof(reqid));
break;
case IPSECSREQID:
if ((error = priv_check(curthread, PRIV_NET_SETIFCAP)) != 0)
break;
- error = copyin(ifr->ifr_data, &reqid, sizeof(reqid));
+ error = copyin(ifr_data_get_ptr(ifr), &reqid, sizeof(reqid));
if (error != 0)
break;
error = ipsec_set_reqid(ifp, reqid);
Modified: stable/11/sys/net/if_spppsubr.c
==============================================================================
--- stable/11/sys/net/if_spppsubr.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_spppsubr.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -5058,17 +5058,17 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
if ((spr = malloc(sizeof(struct spppreq), M_TEMP, M_NOWAIT)) == NULL)
return (EAGAIN);
/*
- * ifr->ifr_data is supposed to point to a struct spppreq.
+ * ifr_data_get_ptr(ifr) is supposed to point to a struct spppreq.
* Check the cmd word first before attempting to fetch all the
* data.
*/
- rv = fueword(ifr->ifr_data, &subcmd);
+ rv = fueword(ifr_data_get_ptr(ifr), &subcmd);
if (rv == -1) {
rv = EFAULT;
goto quit;
}
- if (copyin((caddr_t)ifr->ifr_data, spr, sizeof(struct spppreq)) != 0) {
+ if (copyin(ifr_data_get_ptr(ifr), spr, sizeof(struct spppreq)) != 0) {
rv = EFAULT;
goto quit;
}
@@ -5105,8 +5105,8 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
* setting it.
*/
spr->defs.lcp.timeout = sp->lcp.timeout * 1000 / hz;
- rv = copyout(spr, (caddr_t)ifr->ifr_data,
- sizeof(struct spppreq));
+ rv = copyout(spr, ifr_data_get_ptr(ifr),
+ sizeof(struct spppreq));
break;
case (u_long)SPPPIOSDEFS:
Modified: stable/11/sys/net/if_var.h
==============================================================================
--- stable/11/sys/net/if_var.h Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_var.h Sun Apr 8 16:54:07 2018 (r332288)
@@ -658,6 +658,9 @@ int drbr_enqueue_drv(if_t ifp, struct buf_ring *br, st
void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *);
int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *);
+/* accessors for struct ifreq */
+void *ifr_data_get_ptr(void *ifrp);
+
#ifdef DEVICE_POLLING
enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS };
Modified: stable/11/sys/net/if_vlan.c
==============================================================================
--- stable/11/sys/net/if_vlan.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/if_vlan.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1909,7 +1909,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
break;
}
#endif
- error = copyin(ifr->ifr_data, &vlr, sizeof(vlr));
+ error = copyin(ifr_data_get_ptr(ifr), &vlr, sizeof(vlr));
if (error)
break;
if (vlr.vlr_parent[0] == '\0') {
@@ -1940,7 +1940,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
vlr.vlr_tag = ifv->ifv_vid;
}
VLAN_SUNLOCK();
- error = copyout(&vlr, ifr->ifr_data, sizeof(vlr));
+ error = copyout(&vlr, ifr_data_get_ptr(ifr), sizeof(vlr));
break;
case SIOCSIFFLAGS:
Modified: stable/11/sys/net/iflib.c
==============================================================================
--- stable/11/sys/net/iflib.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net/iflib.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -3260,7 +3260,7 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
{
struct ifi2creq i2c;
- err = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+ err = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (err != 0)
break;
if (i2c.dev_addr != 0xA0 && i2c.dev_addr != 0xA2) {
@@ -3273,7 +3273,8 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
}
if ((err = IFDI_I2C_REQ(ctx, &i2c)) == 0)
- err = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+ err = copyout(&i2c, ifr_data_get_ptr(ifr),
+ sizeof(i2c));
break;
}
case SIOCSIFCAP:
Modified: stable/11/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- stable/11/sys/net80211/ieee80211_ioctl.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/net80211/ieee80211_ioctl.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -3424,7 +3424,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
break;
case SIOCG80211STATS:
ifr = (struct ifreq *)data;
- copyout(&vap->iv_stats, ifr->ifr_data, sizeof (vap->iv_stats));
+ copyout(&vap->iv_stats, ifr_data_get_ptr(ifr),
+ sizeof (vap->iv_stats));
break;
case SIOCSIFMTU:
ifr = (struct ifreq *)data;
Modified: stable/11/sys/netinet/ip_carp.c
==============================================================================
--- stable/11/sys/netinet/ip_carp.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/netinet/ip_carp.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1624,7 +1624,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
struct carp_softc *sc = NULL;
int error = 0, locked = 0;
- if ((error = copyin(ifr->ifr_data, &carpr, sizeof carpr)))
+ if ((error = copyin(ifr_data_get_ptr(ifr), &carpr, sizeof carpr)))
return (error);
ifp = ifunit_ref(ifr->ifr_name);
@@ -1741,7 +1741,8 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
break;
}
carp_carprcp(&carpr, sc, priveleged);
- error = copyout(&carpr, ifr->ifr_data, sizeof(carpr));
+ error = copyout(&carpr, ifr_data_get_ptr(ifr),
+ sizeof(carpr));
} else {
int i, count;
@@ -1759,7 +1760,8 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
IFNET_FOREACH_CARP(ifp, sc) {
carp_carprcp(&carpr, sc, priveleged);
carpr.carpr_count = count;
- error = copyout(&carpr, ifr->ifr_data +
+ error = copyout(&carpr,
+ (caddr_t)ifr_data_get_ptr(ifr) +
(i * sizeof(carpr)), sizeof(carpr));
if (error) {
CIF_UNLOCK(ifp->if_carp);
Modified: stable/11/sys/netpfil/pf/if_pfsync.c
==============================================================================
--- stable/11/sys/netpfil/pf/if_pfsync.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/netpfil/pf/if_pfsync.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -1317,7 +1317,8 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
pfsyncr.pfsyncr_defer = (PFSYNCF_DEFER ==
(sc->sc_flags & PFSYNCF_DEFER));
PFSYNC_UNLOCK(sc);
- return (copyout(&pfsyncr, ifr->ifr_data, sizeof(pfsyncr)));
+ return (copyout(&pfsyncr, ifr_data_get_ptr(ifr),
+ sizeof(pfsyncr)));
case SIOCSETPFSYNC:
{
@@ -1328,7 +1329,8 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
if ((error = priv_check(curthread, PRIV_NETINET_PF)) != 0)
return (error);
- if ((error = copyin(ifr->ifr_data, &pfsyncr, sizeof(pfsyncr))))
+ if ((error = copyin(ifr_data_get_ptr(ifr), &pfsyncr,
+ sizeof(pfsyncr))))
return (error);
if (pfsyncr.pfsyncr_maxupdates > 255)
Modified: stable/11/sys/security/mac/mac_net.c
==============================================================================
--- stable/11/sys/security/mac/mac_net.c Sun Apr 8 16:46:24 2018 (r332287)
+++ stable/11/sys/security/mac/mac_net.c Sun Apr 8 16:54:07 2018 (r332288)
@@ -406,7 +406,7 @@ mac_ifnet_ioctl_get(struct ucred *cred, struct ifreq *
if (!(mac_labeled & MPC_OBJECT_IFNET))
return (EINVAL);
- error = copyin(ifr->ifr_ifru.ifru_data, &mac, sizeof(mac));
+ error = copyin(ifr_data_get_ptr(ifr), &mac, sizeof(mac));
if (error)
return (error);
@@ -449,7 +449,7 @@ mac_ifnet_ioctl_set(struct ucred *cred, struct ifreq *
if (!(mac_labeled & MPC_OBJECT_IFNET))
return (EINVAL);
- error = copyin(ifr->ifr_ifru.ifru_data, &mac, sizeof(mac));
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable
mailing list