datapath: fix sparse warning in function tbl_mask_array_delete_mask()
authorAndy Zhou <azhou@nicira.com>
Tue, 24 Jun 2014 06:00:55 +0000 (23:00 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 1 Jul 2014 19:57:29 +0000 (12:57 -0700)
Sparse gives "incompatible types in comparison expression (different
address spaces)" warning messages. Fix this by add rcu_dereference()
wrappers.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/flow_table.c

index 41f7cb8..9746822 100644 (file)
@@ -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 == ovsl_dereference(ma->masks[i])) {
                        struct sw_flow_mask *last;
 
-                       last = ma->masks[ma->count - 1];
+                       last = ovsl_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 == ovsl_dereference(ma->masks[i]))
                        RCU_INIT_POINTER(ma->masks[i], NULL);
 }