mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
netdev-linux: Return an error if device feature names are empty.
When retrieving a list of features supported by a network card, return
with an error code if the request completed without an error but the
list contains zero entries.
In practice this should never happen, but it does contribute to a
detection in Clang's static analyzer.
Fixes: 6c59c19526
("netdev-linux: Use ethtool to detect offload support.")
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
4837b5fed3
commit
0c1b9b015d
@@ -2440,9 +2440,12 @@ netdev_linux_read_definitions(struct netdev_linux *netdev,
|
||||
int error = 0;
|
||||
|
||||
error = netdev_linux_read_stringset_info(netdev, &len);
|
||||
if (error || !len) {
|
||||
if (error) {
|
||||
return error;
|
||||
} else if (!len) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
strings = xzalloc(sizeof *strings + len * ETH_GSTRING_LEN);
|
||||
|
||||
strings->cmd = ETHTOOL_GSTRINGS;
|
||||
|
Reference in New Issue
Block a user