mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
netdev-linux: Initialize link speed in error conditions.
Clang's static analyzer noted that the output from
netdev_linux_get_speed_locked can be checked even if this function
doesn't set any values.
Now we always set those values to a sane default in all cases.
Fixes: 19cffe30cf
("netdev-linux: Avoid deadlock in netdev_get_speed.")
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
0c1b9b015d
commit
4d25656a23
@@ -2728,6 +2728,7 @@ netdev_linux_get_speed_locked(struct netdev_linux *netdev,
|
||||
uint32_t *current, uint32_t *max)
|
||||
{
|
||||
if (netdev_linux_netnsid_is_remote(netdev)) {
|
||||
*current = *max = 0;
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
@@ -2737,6 +2738,8 @@ netdev_linux_get_speed_locked(struct netdev_linux *netdev,
|
||||
? 0 : netdev->current_speed;
|
||||
*max = MIN(UINT32_MAX,
|
||||
netdev_features_to_bps(netdev->supported, 0) / 1000000ULL);
|
||||
} else {
|
||||
*current = *max = 0;
|
||||
}
|
||||
return netdev->get_features_error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user