[ovs-dev] [PATCH] dpif-netdev: Initialize new rxqs in port_reconfigure().

Kevin Traynor ktraynor at redhat.com
Fri Oct 27 11:04:01 UTC 2017


On 10/27/2017 12:49 AM, Ben Pfaff wrote:
> 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.
> 

Thanks. Actually, with this change I can remove some of the other reset
code also. Will send patch after PTO.

Acked-by: Kevin Traynor <ktraynor at redhat.com>

> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---
>  lib/dpif-netdev.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index d5eb8305c8a2..1418175bdfef 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -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++) {
> 



More information about the dev mailing list