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

Andy Zhou azhou at nicira.com
Wed Jun 25 21:21:01 UTC 2014


Thanks, pushed with suggested changes.

On Wed, Jun 25, 2014 at 1:21 PM, Pravin Shelar <pshelar at nicira.com> wrote:
> On Mon, Jun 23, 2014 at 11:10 PM, Andy Zhou <azhou at nicira.com> wrote:
>> 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);
>>  }
>>
> tbl_mask_array_delete_mask() functions is always called under ovs
> mutex, so deref needs to be done using ovsl_dereference()
>
> Otherwise looks good.
> Acked-by: Pravin B Shelar <pshelar at nicira.com>
>
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list