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: 6c59c195266c ("netdev-linux: Use ethtool to detect offload support.")
Signed-off-by: Mike Pattrick <[email protected]>
---
lib/netdev-linux.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 25349c605..c89a85a38 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2439,9 +2439,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;
--
2.39.3
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev