]> git.baikalelectronics.ru Git - kernel.git/commit
ixgbe: fix potential u32 overflow on shift
authorColin Ian King <colin.king@canonical.com>
Fri, 7 Jun 2019 18:19:20 +0000 (19:19 +0100)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 28 Jun 2019 22:59:38 +0000 (15:59 -0700)
commit14dd4170737aa629c61a7864a67c2c9f6ffdfa20
tree09b7b457bf1287f84cf3965d985e37ba2843d759
parentb115b29f1423328aeeec4d808f0cbce3cae3a4a3
ixgbe: fix potential u32 overflow on shift

The u32 variable rem is being shifted using u32 arithmetic however
it is being passed to div_u64 that expects the expression to be a u64.
The 32 bit shift may potentially overflow, so cast rem to a u64 before
shifting to avoid this.  Also remove comment about overflow.

Addresses-Coverity: ("Unintentional integer overflow")
Fixes: a7607e66560e ("ixgbe: implement support for SDP/PPS output on X550 hardware")
Fixes: b8e862646c93 ("ixgbe: fix PTP SDP pin setup on X540 hardware")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c