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/vnet/interface_format.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/vnet/interface_format.c')
-rw-r--r-- | src/vnet/interface_format.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c index e34b6fb62c0..304fbb8a068 100644 --- a/src/vnet/interface_format.c +++ b/src/vnet/interface_format.c @@ -120,7 +120,7 @@ format_vnet_hw_interface_link_speed (u8 * s, va_list * args) { u32 link_speed = va_arg (*args, u32); - if (link_speed == 0) + if (link_speed == 0 || link_speed == UINT32_MAX) return format (s, "unknown"); if (link_speed >= 1000000) |