diff options
author | Anton Nikolaev <anikolaev@netgate.com> | 2022-05-16 10:33:17 +0000 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2022-05-17 19:42:17 +0000 |
commit | 61f6a4c4f026a83390f41595cb77771a668cc55c (patch) | |
tree | eb7ffe4d7d65fe5c9d00c25720ea31b53aa65070 /src/plugins/dpdk/device/init.c | |
parent | 59a08e65094db28884fc40e9562e303fde3b21d8 (diff) |
interface: fix overflow of link speed.
Type: fix
There were several places where mbps were converted to kbps for
link_speed, but often drivers of devices set link speed to unknown
(0xFFFFFFFF) on initialization, so there was multiplication of
link_speed equal 0xFFFFFFFF(UINT32_MAX) by 1000, this provides
overflow of unsigned int, and as result link_speed was equal
4295 Gbps, but actually link_speed is unknown.
Signed-off-by: Anton Nikolaev <anikolaev@netgate.com>
Change-Id: Ib462ed6ed685654af4687041e115bfb74e640f13
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r-- | src/plugins/dpdk/device/init.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 6d3b8643147..6b1479b9c75 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1390,7 +1390,9 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) } if (xd->link.link_speed != prev_link.link_speed) vnet_hw_interface_set_link_speed (vnm, xd->hw_if_index, - xd->link.link_speed * 1000); + (xd->link.link_speed == UINT32_MAX) ? + UINT32_MAX : + xd->link.link_speed * 1000); if (xd->link.link_status != prev_link.link_status) { |