2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif-netdev: Initialize new rxqs in port_reconfigure().

valgrind reported use of uninitialized data in port_reconfigure(), which
was due to xrealloc() not initializing the newly added data, combined with
dp_netdev_rxq_set_intrvl_cycles() reading 'intrvl_idx' from the added data.
This avoids the warning.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
This commit is contained in:
Ben Pfaff
2017-10-26 16:49:01 -07:00
parent 221df99c5a
commit 38259bd7eb

View File

@@ -3285,9 +3285,14 @@ port_reconfigure(struct dp_netdev_port *port)
port->txq_used = xcalloc(netdev_n_txq(netdev), sizeof *port->txq_used);
for (i = 0; i < netdev_n_rxq(netdev); i++) {
bool new_queue = i >= last_nrxq;
if (new_queue) {
memset(&port->rxqs[i], 0, sizeof port->rxqs[i]);
}
port->rxqs[i].port = port;
if (i >= last_nrxq) {
/* Only reset cycle stats for new queues */
if (new_queue) {
dp_netdev_rxq_set_cycles(&port->rxqs[i], RXQ_CYCLES_PROC_CURR, 0);
dp_netdev_rxq_set_cycles(&port->rxqs[i], RXQ_CYCLES_PROC_HIST, 0);
for (unsigned j = 0; j < PMD_RXQ_INTERVAL_MAX; j++) {