On Sat, Oct 28, 2017 at 04:40:37PM +0800, zhongbaisong wrote:
> From: zhongbasiong <[email protected]>
>
> struct netdev_stats dev_stats was used without initialized.
> As result, the output of 'ovs-vsctl list interface' has some random
> values.
>
> Signed-off-by: zhongbasiong <[email protected]>
> ---
> lib/netdev-linux.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 2ff3e2b..09f174b 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -1726,6 +1726,7 @@ netdev_linux_get_stats(const struct netdev *netdev_,
> int error;
>
> ovs_mutex_lock(&netdev->mutex);
> + memset(&dev_stats, 0, sizeof(struct netdev_stats));
> get_stats_via_vport(netdev_, stats);
> error = get_stats_via_netlink(netdev_, &dev_stats);
> if (error) {
> @@ -1777,6 +1778,7 @@ netdev_tap_get_stats(const struct netdev *netdev_,
> struct netdev_stats *stats)
> int error;
>
> ovs_mutex_lock(&netdev->mutex);
> + memset(&dev_stats, 0, sizeof(struct netdev_stats));
> get_stats_via_vport(netdev_, stats);
> error = get_stats_via_netlink(netdev_, &dev_stats);
> if (error) {
Can you help me to understand this better? The first statement in
get_stats_via_netlink() is
memset(stats, 0xFF, sizeof(struct netdev_stats));
which would seem to overwrite the zeroing in any case.
Thanks,
Ben.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev