diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index e5f558c9d7d01e2946be03897a3abd056c67b504..f7dded9976e97bcb37fbe2944323d1934e97ebf4 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -549,17 +549,20 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf, **/ int i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr) { - struct hwtstamp_config *config = &pf->tstamp_config; + struct hwtstamp_config config; int err; - if (copy_from_user(config, ifr->ifr_data, sizeof(*config))) + if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) return -EFAULT; - err = i40e_ptp_set_timestamp_mode(pf, config); + err = i40e_ptp_set_timestamp_mode(pf, &config); if (err) return err; - return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? + /* save these settings for future reference */ + pf->tstamp_config = config; + + return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0; }