]> git.baikalelectronics.ru Git - kernel.git/commit
e1000e: e1000e_cyclecounter_read(): fix er32(SYSTIML) overflow check
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 20 Apr 2016 15:45:55 +0000 (17:45 +0200)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 13 May 2016 21:52:31 +0000 (14:52 -0700)
commit8518da4301123ef2f395e4d0e83423fbf3b82876
tree51644535024b284fdfbcf890fcf7029f2db42bc2
parentdc751691b9d27c9c1de9a99b298bee1b310cbaae
e1000e: e1000e_cyclecounter_read(): fix er32(SYSTIML) overflow check

If two consecutive reads of the counter are the same, it is also
not an overflow.  "systimel_1 < systimel_2" should be
"systimel_1 <= systimel_2".

Before the patch, we could perform an *erroneous* correction:

Let's say that systimel_1 == systimel_2 == 0xffffffff.
"systimel_1 < systimel_2" is false, we think it's an overflow,
we read "systimeh = er32(SYSTIMH)" which meanwhile had incremented,
and use "(systimeh << 32) + systimel_2" value which is 2^32 too large.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: intel-wired-lan@lists.osuosl.org
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/e1000e/netdev.c