]> git.baikalelectronics.ru Git - kernel.git/commit
igc: return an error if the mac type is unknown in igc_ptp_systim_to_hwtstamp()
authorTom Rix <trix@redhat.com>
Tue, 31 Jan 2023 21:54:37 +0000 (13:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:09 +0000 (11:28 +0100)
commit758b2263031d0fb347fc5e6f70779535fb0104f8
treeaf53898b0c17b1d2ceb3d087cbc4be4db18ec7a6
parent1efed3c62386f034bdb779db13826d9e4fd0b208
igc: return an error if the mac type is unknown in igc_ptp_systim_to_hwtstamp()

[ Upstream commit a2df8463e15c10a8a882090f3d7a760fdb7b189d ]

clang static analysis reports
drivers/net/ethernet/intel/igc/igc_ptp.c:673:3: warning: The left operand of
  '+' is a garbage value [core.UndefinedBinaryOperatorResult]
   ktime_add_ns(shhwtstamps.hwtstamp, adjust);
   ^            ~~~~~~~~~~~~~~~~~~~~

igc_ptp_systim_to_hwtstamp() silently returns without setting the hwtstamp
if the mac type is unknown.  This should be treated as an error.

Fixes: 2d076511849b ("igc: Add support for RX timestamping")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20230131215437.1528994-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/igc/igc_ptp.c