From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
stable <stable@vger.kernel.org>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 1/8] e1000e: fix numeric overflow in phc settime method
Date: Thu, 25 Apr 2013 21:57:04 -0700 [thread overview]
Message-ID: <1366952231-16727-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1366952231-16727-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Richard Cochran <richardcochran@gmail.com>
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>
---
drivers/net/ethernet/intel/e1000e/ptp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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);
--
1.7.11.7
next prev parent reply other threads:[~2013-04-26 4:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 4:57 [net-next 0/8][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-04-26 4:57 ` Jeff Kirsher [this message]
2013-04-26 4:57 ` [net-next 2/8] e1000e: panic caused by Rx traffic arriving while interface going down Jeff Kirsher
2013-04-26 4:57 ` [net-next 3/8] igb: limit udelay for phy changes to 10000us Jeff Kirsher
2013-04-26 4:57 ` [net-next 4/8] ixgbe: fix EICR write in ixgbe_msix_other Jeff Kirsher
2013-04-26 4:57 ` [net-next 5/8] ixgbe: fix register access during ethtool loopback test Jeff Kirsher
2013-04-26 4:57 ` [net-next 6/8] ixgbe: cache AUTOC reads Jeff Kirsher
2013-04-26 4:57 ` [net-next 7/8] ixgbe: add support for disabling link at boot time on 82599 Jeff Kirsher
2013-04-26 4:57 ` [net-next 8/8] ixgbe: add mac type to the version in ethtool_regs Jeff Kirsher
2013-04-27 3:34 ` [net-next 0/8][pull request] Intel Wired LAN Driver Updates David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366952231-16727-2-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=sassmann@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).