diff options
author | Richard Cochran <richardcochran@gmail.com> | 2013-04-22 21:56:34 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-04-25 21:30:02 -0400 |
commit | 73e3dd6b45c4c870fc2641eb04c24e3f12dab1e0 (patch) | |
tree | c910921b9519b792c7a1f43963bb7804e7c714c4 | |
parent | 3a4e0d6a95b2b6f7b22eb7c7361a0fc4289478eb (diff) |
e1000e: fix numeric overflow in phc settime method
The PTP Hardware Clock settime function in the e1000e driver
computes nanoseconds from a struct timespec. The code converts the
seconds field .tv_sec by multiplying it with NSEC_PER_SEC. However,
both operands are of type long, resulting in an unintended overflow.
The patch fixes the issue by using the helper function from time.h.
CC: stable <stable@vger.kernel.org>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ptp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index b477fa53ec94..065f8c80d4f2 100644 --- a/drivers/net/ethernet/intel/e1000e/ptp.c +++ b/drivers/net/ethernet/intel/e1000e/ptp.c | |||
@@ -145,8 +145,7 @@ static int e1000e_phc_settime(struct ptp_clock_info *ptp, | |||
145 | unsigned long flags; | 145 | unsigned long flags; |
146 | u64 ns; | 146 | u64 ns; |
147 | 147 | ||
148 | ns = ts->tv_sec * NSEC_PER_SEC; | 148 | ns = timespec_to_ns(ts); |
149 | ns += ts->tv_nsec; | ||
150 | 149 | ||
151 | /* reset the timecounter */ | 150 | /* reset the timecounter */ |
152 | spin_lock_irqsave(&adapter->systim_lock, flags); | 151 | spin_lock_irqsave(&adapter->systim_lock, flags); |