diff options
author | wzt.wzt@gmail.com <wzt.wzt@gmail.com> | 2010-04-09 07:30:29 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-04-09 01:13:48 -0400 |
commit | c1a7368a6f0b18b10fdec87972da680ebdf03794 (patch) | |
tree | 17a8d306fe2332093e0e11e5fbb03199df011037 /security/selinux | |
parent | e2902eb79fdea3c3bf679a8f15f3432b393cb2c0 (diff) |
Security: Fix coding style in security/
Fix coding style in security/
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/selinuxfs.c | 44 | ||||
-rw-r--r-- | security/selinux/ss/mls.c | 2 | ||||
-rw-r--r-- | security/selinux/ss/policydb.c | 4 | ||||
-rw-r--r-- | security/selinux/ss/services.c | 12 |
4 files changed, 31 insertions, 31 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index cd191bbec03c..0293843f7eda 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -503,11 +503,11 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size) | |||
503 | return length; | 503 | return length; |
504 | 504 | ||
505 | length = -ENOMEM; | 505 | length = -ENOMEM; |
506 | scon = kzalloc(size+1, GFP_KERNEL); | 506 | scon = kzalloc(size + 1, GFP_KERNEL); |
507 | if (!scon) | 507 | if (!scon) |
508 | return length; | 508 | return length; |
509 | 509 | ||
510 | tcon = kzalloc(size+1, GFP_KERNEL); | 510 | tcon = kzalloc(size + 1, GFP_KERNEL); |
511 | if (!tcon) | 511 | if (!tcon) |
512 | goto out; | 512 | goto out; |
513 | 513 | ||
@@ -515,10 +515,10 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size) | |||
515 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 515 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
516 | goto out2; | 516 | goto out2; |
517 | 517 | ||
518 | length = security_context_to_sid(scon, strlen(scon)+1, &ssid); | 518 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); |
519 | if (length < 0) | 519 | if (length < 0) |
520 | goto out2; | 520 | goto out2; |
521 | length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid); | 521 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); |
522 | if (length < 0) | 522 | if (length < 0) |
523 | goto out2; | 523 | goto out2; |
524 | 524 | ||
@@ -550,11 +550,11 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) | |||
550 | return length; | 550 | return length; |
551 | 551 | ||
552 | length = -ENOMEM; | 552 | length = -ENOMEM; |
553 | scon = kzalloc(size+1, GFP_KERNEL); | 553 | scon = kzalloc(size + 1, GFP_KERNEL); |
554 | if (!scon) | 554 | if (!scon) |
555 | return length; | 555 | return length; |
556 | 556 | ||
557 | tcon = kzalloc(size+1, GFP_KERNEL); | 557 | tcon = kzalloc(size + 1, GFP_KERNEL); |
558 | if (!tcon) | 558 | if (!tcon) |
559 | goto out; | 559 | goto out; |
560 | 560 | ||
@@ -562,10 +562,10 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) | |||
562 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 562 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
563 | goto out2; | 563 | goto out2; |
564 | 564 | ||
565 | length = security_context_to_sid(scon, strlen(scon)+1, &ssid); | 565 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); |
566 | if (length < 0) | 566 | if (length < 0) |
567 | goto out2; | 567 | goto out2; |
568 | length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid); | 568 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); |
569 | if (length < 0) | 569 | if (length < 0) |
570 | goto out2; | 570 | goto out2; |
571 | 571 | ||
@@ -609,11 +609,11 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size) | |||
609 | return length; | 609 | return length; |
610 | 610 | ||
611 | length = -ENOMEM; | 611 | length = -ENOMEM; |
612 | scon = kzalloc(size+1, GFP_KERNEL); | 612 | scon = kzalloc(size + 1, GFP_KERNEL); |
613 | if (!scon) | 613 | if (!scon) |
614 | return length; | 614 | return length; |
615 | 615 | ||
616 | tcon = kzalloc(size+1, GFP_KERNEL); | 616 | tcon = kzalloc(size + 1, GFP_KERNEL); |
617 | if (!tcon) | 617 | if (!tcon) |
618 | goto out; | 618 | goto out; |
619 | 619 | ||
@@ -621,10 +621,10 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size) | |||
621 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 621 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
622 | goto out2; | 622 | goto out2; |
623 | 623 | ||
624 | length = security_context_to_sid(scon, strlen(scon)+1, &ssid); | 624 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); |
625 | if (length < 0) | 625 | if (length < 0) |
626 | goto out2; | 626 | goto out2; |
627 | length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid); | 627 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); |
628 | if (length < 0) | 628 | if (length < 0) |
629 | goto out2; | 629 | goto out2; |
630 | 630 | ||
@@ -666,11 +666,11 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size) | |||
666 | return length; | 666 | return length; |
667 | 667 | ||
668 | length = -ENOMEM; | 668 | length = -ENOMEM; |
669 | con = kzalloc(size+1, GFP_KERNEL); | 669 | con = kzalloc(size + 1, GFP_KERNEL); |
670 | if (!con) | 670 | if (!con) |
671 | return length; | 671 | return length; |
672 | 672 | ||
673 | user = kzalloc(size+1, GFP_KERNEL); | 673 | user = kzalloc(size + 1, GFP_KERNEL); |
674 | if (!user) | 674 | if (!user) |
675 | goto out; | 675 | goto out; |
676 | 676 | ||
@@ -678,7 +678,7 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size) | |||
678 | if (sscanf(buf, "%s %s", con, user) != 2) | 678 | if (sscanf(buf, "%s %s", con, user) != 2) |
679 | goto out2; | 679 | goto out2; |
680 | 680 | ||
681 | length = security_context_to_sid(con, strlen(con)+1, &sid); | 681 | length = security_context_to_sid(con, strlen(con) + 1, &sid); |
682 | if (length < 0) | 682 | if (length < 0) |
683 | goto out2; | 683 | goto out2; |
684 | 684 | ||
@@ -727,11 +727,11 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) | |||
727 | return length; | 727 | return length; |
728 | 728 | ||
729 | length = -ENOMEM; | 729 | length = -ENOMEM; |
730 | scon = kzalloc(size+1, GFP_KERNEL); | 730 | scon = kzalloc(size + 1, GFP_KERNEL); |
731 | if (!scon) | 731 | if (!scon) |
732 | return length; | 732 | return length; |
733 | 733 | ||
734 | tcon = kzalloc(size+1, GFP_KERNEL); | 734 | tcon = kzalloc(size + 1, GFP_KERNEL); |
735 | if (!tcon) | 735 | if (!tcon) |
736 | goto out; | 736 | goto out; |
737 | 737 | ||
@@ -739,10 +739,10 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) | |||
739 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 739 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
740 | goto out2; | 740 | goto out2; |
741 | 741 | ||
742 | length = security_context_to_sid(scon, strlen(scon)+1, &ssid); | 742 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); |
743 | if (length < 0) | 743 | if (length < 0) |
744 | goto out2; | 744 | goto out2; |
745 | length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid); | 745 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); |
746 | if (length < 0) | 746 | if (length < 0) |
747 | goto out2; | 747 | goto out2; |
748 | 748 | ||
@@ -1401,7 +1401,7 @@ static int sel_make_perm_files(char *objclass, int classvalue, | |||
1401 | } | 1401 | } |
1402 | inode->i_fop = &sel_perm_ops; | 1402 | inode->i_fop = &sel_perm_ops; |
1403 | /* i+1 since perm values are 1-indexed */ | 1403 | /* i+1 since perm values are 1-indexed */ |
1404 | inode->i_ino = sel_perm_to_ino(classvalue, i+1); | 1404 | inode->i_ino = sel_perm_to_ino(classvalue, i + 1); |
1405 | d_add(dentry, inode); | 1405 | d_add(dentry, inode); |
1406 | } | 1406 | } |
1407 | 1407 | ||
@@ -1489,7 +1489,7 @@ static int sel_make_classes(void) | |||
1489 | goto out; | 1489 | goto out; |
1490 | 1490 | ||
1491 | /* +2 since classes are 1-indexed */ | 1491 | /* +2 since classes are 1-indexed */ |
1492 | last_class_ino = sel_class_to_ino(nclasses+2); | 1492 | last_class_ino = sel_class_to_ino(nclasses + 2); |
1493 | 1493 | ||
1494 | for (i = 0; i < nclasses; i++) { | 1494 | for (i = 0; i < nclasses; i++) { |
1495 | struct dentry *class_name_dir; | 1495 | struct dentry *class_name_dir; |
@@ -1506,7 +1506,7 @@ static int sel_make_classes(void) | |||
1506 | goto out1; | 1506 | goto out1; |
1507 | 1507 | ||
1508 | /* i+1 since class values are 1-indexed */ | 1508 | /* i+1 since class values are 1-indexed */ |
1509 | rc = sel_make_class_dir_entries(classes[i], i+1, | 1509 | rc = sel_make_class_dir_entries(classes[i], i + 1, |
1510 | class_name_dir); | 1510 | class_name_dir); |
1511 | if (rc) | 1511 | if (rc) |
1512 | goto out1; | 1512 | goto out1; |
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index 372b773f8210..b4eff7a60c50 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c | |||
@@ -255,7 +255,7 @@ int mls_context_to_sid(struct policydb *pol, | |||
255 | 255 | ||
256 | if (!pol->mls_enabled) { | 256 | if (!pol->mls_enabled) { |
257 | if (def_sid != SECSID_NULL && oldc) | 257 | if (def_sid != SECSID_NULL && oldc) |
258 | *scontext += strlen(*scontext)+1; | 258 | *scontext += strlen(*scontext) + 1; |
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | 261 | ||
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 24ced65ac4ff..4f584fb71ef9 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -156,7 +156,7 @@ static int roles_init(struct policydb *p) | |||
156 | rc = -EINVAL; | 156 | rc = -EINVAL; |
157 | goto out_free_role; | 157 | goto out_free_role; |
158 | } | 158 | } |
159 | key = kmalloc(strlen(OBJECT_R)+1, GFP_KERNEL); | 159 | key = kmalloc(strlen(OBJECT_R) + 1, GFP_KERNEL); |
160 | if (!key) { | 160 | if (!key) { |
161 | rc = -ENOMEM; | 161 | rc = -ENOMEM; |
162 | goto out_free_role; | 162 | goto out_free_role; |
@@ -2195,7 +2195,7 @@ int policydb_read(struct policydb *p, void *fp) | |||
2195 | rangetr_hash_eval(p->range_tr); | 2195 | rangetr_hash_eval(p->range_tr); |
2196 | } | 2196 | } |
2197 | 2197 | ||
2198 | p->type_attr_map = kmalloc(p->p_types.nprim*sizeof(struct ebitmap), GFP_KERNEL); | 2198 | p->type_attr_map = kmalloc(p->p_types.nprim * sizeof(struct ebitmap), GFP_KERNEL); |
2199 | if (!p->type_attr_map) | 2199 | if (!p->type_attr_map) |
2200 | goto bad; | 2200 | goto bad; |
2201 | 2201 | ||
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index cf27b3ee1a95..0b44f5a2b7b0 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -274,15 +274,15 @@ static int constraint_expr_eval(struct context *scontext, | |||
274 | case CEXPR_AND: | 274 | case CEXPR_AND: |
275 | BUG_ON(sp < 1); | 275 | BUG_ON(sp < 1); |
276 | sp--; | 276 | sp--; |
277 | s[sp] &= s[sp+1]; | 277 | s[sp] &= s[sp + 1]; |
278 | break; | 278 | break; |
279 | case CEXPR_OR: | 279 | case CEXPR_OR: |
280 | BUG_ON(sp < 1); | 280 | BUG_ON(sp < 1); |
281 | sp--; | 281 | sp--; |
282 | s[sp] |= s[sp+1]; | 282 | s[sp] |= s[sp + 1]; |
283 | break; | 283 | break; |
284 | case CEXPR_ATTR: | 284 | case CEXPR_ATTR: |
285 | if (sp == (CEXPR_MAXDEPTH-1)) | 285 | if (sp == (CEXPR_MAXDEPTH - 1)) |
286 | return 0; | 286 | return 0; |
287 | switch (e->attr) { | 287 | switch (e->attr) { |
288 | case CEXPR_USER: | 288 | case CEXPR_USER: |
@@ -1216,7 +1216,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, | |||
1216 | *sid = SECSID_NULL; | 1216 | *sid = SECSID_NULL; |
1217 | 1217 | ||
1218 | /* Copy the string so that we can modify the copy as we parse it. */ | 1218 | /* Copy the string so that we can modify the copy as we parse it. */ |
1219 | scontext2 = kmalloc(scontext_len+1, gfp_flags); | 1219 | scontext2 = kmalloc(scontext_len + 1, gfp_flags); |
1220 | if (!scontext2) | 1220 | if (!scontext2) |
1221 | return -ENOMEM; | 1221 | return -ENOMEM; |
1222 | memcpy(scontext2, scontext, scontext_len); | 1222 | memcpy(scontext2, scontext, scontext_len); |
@@ -2101,9 +2101,9 @@ int security_get_user_sids(u32 fromsid, | |||
2101 | 2101 | ||
2102 | ebitmap_for_each_positive_bit(&user->roles, rnode, i) { | 2102 | ebitmap_for_each_positive_bit(&user->roles, rnode, i) { |
2103 | role = policydb.role_val_to_struct[i]; | 2103 | role = policydb.role_val_to_struct[i]; |
2104 | usercon.role = i+1; | 2104 | usercon.role = i + 1; |
2105 | ebitmap_for_each_positive_bit(&role->types, tnode, j) { | 2105 | ebitmap_for_each_positive_bit(&role->types, tnode, j) { |
2106 | usercon.type = j+1; | 2106 | usercon.type = j + 1; |
2107 | 2107 | ||
2108 | if (mls_setup_user_range(fromcon, user, &usercon)) | 2108 | if (mls_setup_user_range(fromcon, user, &usercon)) |
2109 | continue; | 2109 | continue; |