[ovs-dev] [PATCH] datapath: fix sparse warning in function tbl_mask_array_delete_mask()

Andy Zhou azhou at nicira.com
Tue Jun 24 06:10:10 UTC 2014


Sparse gives "incompatible types in comparison expression (different
address spaces)" warning messages. Fix this by add rcu_dereference()
wrappers.

Reported-by: Ben Pfaff <blp at nicira.com>
Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 datapath/flow_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/datapath/flow_table.c b/datapath/flow_table.c
index 41f7cb8..11261ec 100644
--- a/datapath/flow_table.c
+++ b/datapath/flow_table.c
@@ -286,10 +286,10 @@ static void tbl_mask_array_delete_mask(struct mask_array *ma,
 	 * </Note>
 	 */
 	for (i = 0; i < ma->count; i++)
-		if (mask == ma->masks[i]) {
+		if (mask == rcu_dereference(ma->masks[i])) {
 			struct sw_flow_mask *last;
 
-			last = ma->masks[ma->count - 1];
+			last = rcu_dereference(ma->masks[ma->count - 1]);
 			rcu_assign_pointer(ma->masks[i], last);
 			ma->count--;
 			break;
@@ -297,7 +297,7 @@ static void tbl_mask_array_delete_mask(struct mask_array *ma,
 
 	/* Remove the deleted mask pointers from the invalid section. */
 	for (i = ma->count; i < ma->max; i++)
-		if (mask == ma->masks[i])
+		if (mask == rcu_dereference(ma->masks[i]))
 			RCU_INIT_POINTER(ma->masks[i], NULL);
 }
 
-- 
1.9.1




More information about the dev mailing list