diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-12-13 15:29:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-14 02:39:30 -0500 |
commit | f9586f79bf6125ae28fab9f585094c56e8740e83 (patch) | |
tree | eea369cc3ac135bc9841c453ffdb2b81cc72d884 /net/8021q | |
parent | c63044f0d22a13532047ad04216af45b6ac7fdaf (diff) |
vlan: add rtnl_dereference() annotations
The original code generates a Sparse warning:
net/8021q/vlan_core.c:336:9:
error: incompatible types in comparison expression (different address spaces)
It's ok to dereference __rcu pointers here because we are holding the
RTNL lock. I've added some calls to rtnl_dereference() to silence the
warning.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan_core.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 1414c931bd3f..4d39d802be2c 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -326,14 +326,16 @@ int vlan_vids_add_by_dev(struct net_device *dev, | |||
326 | const struct net_device *by_dev) | 326 | const struct net_device *by_dev) |
327 | { | 327 | { |
328 | struct vlan_vid_info *vid_info; | 328 | struct vlan_vid_info *vid_info; |
329 | struct vlan_info *vlan_info; | ||
329 | int err; | 330 | int err; |
330 | 331 | ||
331 | ASSERT_RTNL(); | 332 | ASSERT_RTNL(); |
332 | 333 | ||
333 | if (!by_dev->vlan_info) | 334 | vlan_info = rtnl_dereference(by_dev->vlan_info); |
335 | if (!vlan_info) | ||
334 | return 0; | 336 | return 0; |
335 | 337 | ||
336 | list_for_each_entry(vid_info, &by_dev->vlan_info->vid_list, list) { | 338 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) { |
337 | err = vlan_vid_add(dev, vid_info->vid); | 339 | err = vlan_vid_add(dev, vid_info->vid); |
338 | if (err) | 340 | if (err) |
339 | goto unwind; | 341 | goto unwind; |
@@ -342,7 +344,7 @@ int vlan_vids_add_by_dev(struct net_device *dev, | |||
342 | 344 | ||
343 | unwind: | 345 | unwind: |
344 | list_for_each_entry_continue_reverse(vid_info, | 346 | list_for_each_entry_continue_reverse(vid_info, |
345 | &by_dev->vlan_info->vid_list, | 347 | &vlan_info->vid_list, |
346 | list) { | 348 | list) { |
347 | vlan_vid_del(dev, vid_info->vid); | 349 | vlan_vid_del(dev, vid_info->vid); |
348 | } | 350 | } |
@@ -355,13 +357,15 @@ void vlan_vids_del_by_dev(struct net_device *dev, | |||
355 | const struct net_device *by_dev) | 357 | const struct net_device *by_dev) |
356 | { | 358 | { |
357 | struct vlan_vid_info *vid_info; | 359 | struct vlan_vid_info *vid_info; |
360 | struct vlan_info *vlan_info; | ||
358 | 361 | ||
359 | ASSERT_RTNL(); | 362 | ASSERT_RTNL(); |
360 | 363 | ||
361 | if (!by_dev->vlan_info) | 364 | vlan_info = rtnl_dereference(by_dev->vlan_info); |
365 | if (!vlan_info) | ||
362 | return; | 366 | return; |
363 | 367 | ||
364 | list_for_each_entry(vid_info, &by_dev->vlan_info->vid_list, list) | 368 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) |
365 | vlan_vid_del(dev, vid_info->vid); | 369 | vlan_vid_del(dev, vid_info->vid); |
366 | } | 370 | } |
367 | EXPORT_SYMBOL(vlan_vids_del_by_dev); | 371 | EXPORT_SYMBOL(vlan_vids_del_by_dev); |