VLOG_WARN_BUF() allocates a new string with xasprintf() every time it is
called and overwrites *errp without freeing the previous value. This can
lead to a memory leak if multiple warnings are emitted or if a later
hard error in netdev_dpdk_set_config() also writes
to errp.
The three cases in dpdk_set_rx_steer_config() are not fatal errors:
- unsupported rx-steering value
- rss+lacp on non-ethernet port
- rss+lacp together with hw-offload
In all cases program simply log a warning and fall back to default RSS
steering. Configuration continues normally (err remains 0 and execution
flow do not goto out).
Therefore change them to plain VLOG_WARN(). As a result the 'errp'
parameter becomes unused and is removed from the function signature and
the call site in netdev_dpdk_set_config().
This makes the code cleaner and consistent with the rest of netdev-dpdk.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: fc06ea9a1883 ("netdev-dpdk: Add custom rx-steering configuration.")
Signed-off-by: Mikhail Dmitrichenko <[email protected]>
---
lib/netdev-dpdk.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 54959ff0d..e75b9ad55 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2251,7 +2251,7 @@ dpdk_process_queue_size(struct netdev *netdev, const
struct smap *args,
static void
dpdk_set_rx_steer_config(struct netdev *netdev, struct netdev_dpdk *dev,
- const struct smap *args, char **errp)
+ const struct smap *args)
{
const char *arg = smap_get_def(args, "rx-steering", "rss");
uint64_t flags = 0;
@@ -2259,22 +2259,19 @@ dpdk_set_rx_steer_config(struct netdev *netdev, struct
netdev_dpdk *dev,
if (!strcmp(arg, "rss+lacp")) {
flags = DPDK_RX_STEER_LACP;
} else if (strcmp(arg, "rss")) {
- VLOG_WARN_BUF(errp, "%s: options:rx-steering "
- "unsupported parameter value '%s'",
- netdev_get_name(netdev), arg);
+ VLOG_WARN("%s: options:rx-steering unsupported parameter value '%s'",
+ netdev_get_name(netdev), arg);
}
if (flags && dev->type != DPDK_DEV_ETH) {
- VLOG_WARN_BUF(errp, "%s: options:rx-steering "
- "is only supported on ethernet ports",
- netdev_get_name(netdev));
+ VLOG_WARN("%s: options:rx-steering is only supported on ethernet
ports",
+ netdev_get_name(netdev));
flags = 0;
}
if (flags && dpif_offload_enabled()) {
- VLOG_WARN_BUF(errp, "%s: options:rx-steering "
- "is incompatible with hw-offload",
- netdev_get_name(netdev));
+ VLOG_WARN("%s: options:rx-steering is incompatible with hw-offload",
+ netdev_get_name(netdev));
flags = 0;
}
@@ -2304,7 +2301,7 @@ netdev_dpdk_set_config(struct netdev *netdev, const
struct smap *args,
ovs_mutex_lock(&dpdk_mutex);
ovs_mutex_lock(&dev->mutex);
- dpdk_set_rx_steer_config(netdev, dev, args, errp);
+ dpdk_set_rx_steer_config(netdev, dev, args);
dpdk_set_rxq_config(dev, args);
--
2.39.2
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev