]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 22 Jun 2017 06:24:39 +0000 (23:24 -0700)
commitaa5391b028476227d68ba47f915d57403b08d914
tree831af3bd73c05638758c72bf9cb4a5b91a4a2119
parentfdad3b2afce93ce3b54e87e0c28d9db12c372106
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>
Orabug: 26243014
(cherry picked from commit a07fd74d5ea9c45a5c6e41f7cb4b997cf40d50f3)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/e1000e/netdev.c