[ovs-dev] [PATCH 04/10] datapath: Don't directly access port array in query_port().

Jesse Gross jesse at nicira.com
Wed Dec 29 18:28:27 UTC 2010


On Wed, Dec 29, 2010 at 12:59 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Tue, Dec 28, 2010 at 08:50:42PM -0800, Jesse Gross wrote:
>> query_port() directly accesses the datapath port array, without
>> using any kind of RCU dereference.  It's OK, since it is holding
>> DP mutex but this adds an explicit check to make sparse happy.
>> It also simplifies the code path somewhat.
>>
>> Found with sparse.
>>
>> Signed-off-by: Jesse Gross <jesse at nicira.com>
>
> Doesn't the "if" below still reference the datapath port array without
> RCU dereference?  I would use the get_vport_protected() call to retrieve
> the vport and then check it for NULL.

You're right (though sparse doesn't flag it since the pointer isn't
dereferenced).  I made that change.




More information about the dev mailing list