aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2008-10-10 10:16:29 -0400
committerPaul Moore <paul.moore@hp.com>2008-10-10 10:16:29 -0400
commit561967010edef40f539dacf2aa125e20773ab40b (patch)
tree90532a13377f81e213bc6904a29762866d34b68e /net/netlabel
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
netlabel: Fix some sparse warnings
Fix a few sparse warnings. One dealt with a RCU lock being held on error, another dealt with an improper type caused by a signed/unsigned mixup while the rest appeared to be caused by using rcu_dereference() in a list_for_each_entry_rcu() call. The latter probably isn't a big deal, but I derive a certain pleasure from knowing that the net/netlabel is nice and clean. Thanks to James Morris for pointing out the issues and demonstrating how to run sparse. Signed-off-by: Paul Moore <paul.moore@hp.com>
Diffstat (limited to 'net/netlabel')
-rw-r--r--net/netlabel/netlabel_cipso_v4.c4
-rw-r--r--net/netlabel/netlabel_domainhash.c12
-rw-r--r--net/netlabel/netlabel_unlabeled.c12
3 files changed, 14 insertions, 14 deletions
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index 0aec318bf0ef..aaf50032b3ac 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -491,7 +491,7 @@ list_start:
491 doi_def = cipso_v4_doi_getdef(doi); 491 doi_def = cipso_v4_doi_getdef(doi);
492 if (doi_def == NULL) { 492 if (doi_def == NULL) {
493 ret_val = -EINVAL; 493 ret_val = -EINVAL;
494 goto list_failure; 494 goto list_failure_lock;
495 } 495 }
496 496
497 ret_val = nla_put_u32(ans_skb, NLBL_CIPSOV4_A_MTYPE, doi_def->type); 497 ret_val = nla_put_u32(ans_skb, NLBL_CIPSOV4_A_MTYPE, doi_def->type);
@@ -655,7 +655,7 @@ static int netlbl_cipsov4_listall(struct sk_buff *skb,
655 struct netlink_callback *cb) 655 struct netlink_callback *cb)
656{ 656{
657 struct netlbl_cipsov4_doiwalk_arg cb_arg; 657 struct netlbl_cipsov4_doiwalk_arg cb_arg;
658 int doi_skip = cb->args[0]; 658 u32 doi_skip = cb->args[0];
659 659
660 cb_arg.nl_cb = cb; 660 cb_arg.nl_cb = cb;
661 cb_arg.skb = skb; 661 cb_arg.skb = skb;
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index 643c032a3a57..dc42206c4312 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -115,13 +115,13 @@ static u32 netlbl_domhsh_hash(const char *key)
115static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain) 115static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain)
116{ 116{
117 u32 bkt; 117 u32 bkt;
118 struct list_head *bkt_list;
118 struct netlbl_dom_map *iter; 119 struct netlbl_dom_map *iter;
119 120
120 if (domain != NULL) { 121 if (domain != NULL) {
121 bkt = netlbl_domhsh_hash(domain); 122 bkt = netlbl_domhsh_hash(domain);
122 list_for_each_entry_rcu(iter, 123 bkt_list = &rcu_dereference(netlbl_domhsh)->tbl[bkt];
123 &rcu_dereference(netlbl_domhsh)->tbl[bkt], 124 list_for_each_entry_rcu(iter, bkt_list, list)
124 list)
125 if (iter->valid && strcmp(iter->domain, domain) == 0) 125 if (iter->valid && strcmp(iter->domain, domain) == 0)
126 return iter; 126 return iter;
127 } 127 }
@@ -410,6 +410,7 @@ int netlbl_domhsh_walk(u32 *skip_bkt,
410{ 410{
411 int ret_val = -ENOENT; 411 int ret_val = -ENOENT;
412 u32 iter_bkt; 412 u32 iter_bkt;
413 struct list_head *iter_list;
413 struct netlbl_dom_map *iter_entry; 414 struct netlbl_dom_map *iter_entry;
414 u32 chain_cnt = 0; 415 u32 chain_cnt = 0;
415 416
@@ -417,9 +418,8 @@ int netlbl_domhsh_walk(u32 *skip_bkt,
417 for (iter_bkt = *skip_bkt; 418 for (iter_bkt = *skip_bkt;
418 iter_bkt < rcu_dereference(netlbl_domhsh)->size; 419 iter_bkt < rcu_dereference(netlbl_domhsh)->size;
419 iter_bkt++, chain_cnt = 0) { 420 iter_bkt++, chain_cnt = 0) {
420 list_for_each_entry_rcu(iter_entry, 421 iter_list = &rcu_dereference(netlbl_domhsh)->tbl[iter_bkt];
421 &rcu_dereference(netlbl_domhsh)->tbl[iter_bkt], 422 list_for_each_entry_rcu(iter_entry, iter_list, list)
422 list)
423 if (iter_entry->valid) { 423 if (iter_entry->valid) {
424 if (chain_cnt++ < *skip_chain) 424 if (chain_cnt++ < *skip_chain)
425 continue; 425 continue;
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 921c118ead89..cc105a10e3f8 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -381,12 +381,12 @@ static struct netlbl_unlhsh_addr6 *netlbl_unlhsh_search_addr6(
381static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex) 381static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
382{ 382{
383 u32 bkt; 383 u32 bkt;
384 struct list_head *bkt_list;
384 struct netlbl_unlhsh_iface *iter; 385 struct netlbl_unlhsh_iface *iter;
385 386
386 bkt = netlbl_unlhsh_hash(ifindex); 387 bkt = netlbl_unlhsh_hash(ifindex);
387 list_for_each_entry_rcu(iter, 388 bkt_list = &rcu_dereference(netlbl_unlhsh)->tbl[bkt];
388 &rcu_dereference(netlbl_unlhsh)->tbl[bkt], 389 list_for_each_entry_rcu(iter, bkt_list, list)
389 list)
390 if (iter->valid && iter->ifindex == ifindex) 390 if (iter->valid && iter->ifindex == ifindex)
391 return iter; 391 return iter;
392 392
@@ -1427,6 +1427,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1427 struct netlbl_unlhsh_iface *iface; 1427 struct netlbl_unlhsh_iface *iface;
1428 struct netlbl_unlhsh_addr4 *addr4; 1428 struct netlbl_unlhsh_addr4 *addr4;
1429 struct netlbl_unlhsh_addr6 *addr6; 1429 struct netlbl_unlhsh_addr6 *addr6;
1430 struct list_head *iter_list;
1430 1431
1431 cb_arg.nl_cb = cb; 1432 cb_arg.nl_cb = cb;
1432 cb_arg.skb = skb; 1433 cb_arg.skb = skb;
@@ -1436,9 +1437,8 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1436 for (iter_bkt = skip_bkt; 1437 for (iter_bkt = skip_bkt;
1437 iter_bkt < rcu_dereference(netlbl_unlhsh)->size; 1438 iter_bkt < rcu_dereference(netlbl_unlhsh)->size;
1438 iter_bkt++, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0) { 1439 iter_bkt++, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0) {
1439 list_for_each_entry_rcu(iface, 1440 iter_list = &rcu_dereference(netlbl_unlhsh)->tbl[iter_bkt];
1440 &rcu_dereference(netlbl_unlhsh)->tbl[iter_bkt], 1441 list_for_each_entry_rcu(iface, iter_list, list) {
1441 list) {
1442 if (!iface->valid || 1442 if (!iface->valid ||
1443 iter_chain++ < skip_chain) 1443 iter_chain++ < skip_chain)
1444 continue; 1444 continue;