Message ID | 1455e8dd5f574fef93377b61cea8b494102091ef.1366638698.git.richardcochran@gmail.com |
---|---|
State | Awaiting Upstream, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2013-04-22 at 15:53 +0200, Richard Cochran wrote: > > 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. > > Signed-off-by: Richard Cochran <richardcochran@gmail.com> > --- > drivers/net/ethernet/intel/e1000e/ptp.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) Thanks Richard, I will add this to my queue.
On Mon, Apr 22, 2013 at 10:53:22AM -0700, Jeff Kirsher wrote: > > Thanks Richard, I will add this to my queue. If it doesn't make it into 3.9, please submit this one to stable, too. Thanks, Richard -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 2013-04-22 at 19:56 +0200, Richard Cochran wrote: > On Mon, Apr 22, 2013 at 10:53:22AM -0700, Jeff Kirsher wrote: > > > > Thanks Richard, I will add this to my queue. > > If it doesn't make it into 3.9, please submit this one to stable, too. > > Thanks, > Richard > Got it, will do.
diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index b477fa5..065f8c8 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, unsigned long flags; u64 ns; - ns = ts->tv_sec * NSEC_PER_SEC; - ns += ts->tv_nsec; + ns = timespec_to_ns(ts); /* reset the timecounter */ spin_lock_irqsave(&adapter->systim_lock, flags);
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. Signed-off-by: Richard Cochran <richardcochran@gmail.com> --- drivers/net/ethernet/intel/e1000e/ptp.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)