summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/meter.c
diff options
context:
space:
mode:
authorTonghao Zhang <xiangxia.m.yue@gmail.com>2020-04-25 05:39:47 +0200
committerDavid S. Miller <davem@davemloft.net>2020-04-26 05:48:21 +0200
commit4b36a0dff794a00989a50581aed2f94c88b57107 (patch)
treed3189c20d7458056879f7a4882f5cf4eaad8cdee /net/openvswitch/meter.c
parentMerge branch 'hinic-add-SR-IOV-support' (diff)
downloadlinux-4b36a0dff794a00989a50581aed2f94c88b57107.tar.xz
linux-4b36a0dff794a00989a50581aed2f94c88b57107.zip
net: openvswitch: suitable access to the dp_meters
To fix the following sparse warning: | net/openvswitch/meter.c:109:38: sparse: sparse: incorrect type | in assignment (different address spaces) ... | net/openvswitch/meter.c:720:45: sparse: sparse: incorrect type | in argument 1 (different address spaces) ... Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/meter.c')
-rw-r--r--net/openvswitch/meter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 915f31123f23..612ad5586ce9 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -107,8 +107,8 @@ dp_meter_instance_realloc(struct dp_meter_table *tbl, u32 size)
return -ENOMEM;
for (i = 0; i < n_meters; i++)
- new_ti->dp_meters[i] =
- rcu_dereference_ovsl(ti->dp_meters[i]);
+ if (rcu_dereference_ovsl(ti->dp_meters[i]))
+ new_ti->dp_meters[i] = ti->dp_meters[i];
rcu_assign_pointer(tbl->ti, new_ti);
call_rcu(&ti->rcu, dp_meter_instance_free_rcu);
@@ -752,7 +752,7 @@ void ovs_meters_exit(struct datapath *dp)
int i;
for (i = 0; i < ti->n_meters; i++)
- ovs_meter_free(ti->dp_meters[i]);
+ ovs_meter_free(rcu_dereference_raw(ti->dp_meters[i]));
dp_meter_instance_free(ti);
}