aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCal Peake <cp@absolutedigital.net>2006-10-01 02:27:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:20 -0400
commit756184b7d771992f4fb1998d62aebcaf3e028076 (patch)
treef3ff7af2a600b1e5a9b60e030057c8b3d589499a
parentc7bce3097c0f9bbed76ee6fd03742f2624031a45 (diff)
[PATCH] CodingStyle cleanup for kernel/sys.c
Fix up kernel/sys.c to be consistent with CodingStyle and the rest of the file. Signed-off-by: Cal Peake <cp@absolutedigital.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/sys.c80
1 files changed, 30 insertions, 50 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b88806c66244..2460581c928c 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -607,11 +607,10 @@ static void kernel_restart_prepare(char *cmd)
607void kernel_restart(char *cmd) 607void kernel_restart(char *cmd)
608{ 608{
609 kernel_restart_prepare(cmd); 609 kernel_restart_prepare(cmd);
610 if (!cmd) { 610 if (!cmd)
611 printk(KERN_EMERG "Restarting system.\n"); 611 printk(KERN_EMERG "Restarting system.\n");
612 } else { 612 else
613 printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); 613 printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
614 }
615 machine_restart(cmd); 614 machine_restart(cmd);
616} 615}
617EXPORT_SYMBOL_GPL(kernel_restart); 616EXPORT_SYMBOL_GPL(kernel_restart);
@@ -627,9 +626,8 @@ static void kernel_kexec(void)
627#ifdef CONFIG_KEXEC 626#ifdef CONFIG_KEXEC
628 struct kimage *image; 627 struct kimage *image;
629 image = xchg(&kexec_image, NULL); 628 image = xchg(&kexec_image, NULL);
630 if (!image) { 629 if (!image)
631 return; 630 return;
632 }
633 kernel_restart_prepare(NULL); 631 kernel_restart_prepare(NULL);
634 printk(KERN_EMERG "Starting new kernel\n"); 632 printk(KERN_EMERG "Starting new kernel\n");
635 machine_shutdown(); 633 machine_shutdown();
@@ -823,12 +821,10 @@ asmlinkage long sys_setregid(gid_t rgid, gid_t egid)
823 (current->sgid == egid) || 821 (current->sgid == egid) ||
824 capable(CAP_SETGID)) 822 capable(CAP_SETGID))
825 new_egid = egid; 823 new_egid = egid;
826 else { 824 else
827 return -EPERM; 825 return -EPERM;
828 }
829 } 826 }
830 if (new_egid != old_egid) 827 if (new_egid != old_egid) {
831 {
832 current->mm->dumpable = suid_dumpable; 828 current->mm->dumpable = suid_dumpable;
833 smp_wmb(); 829 smp_wmb();
834 } 830 }
@@ -857,19 +853,14 @@ asmlinkage long sys_setgid(gid_t gid)
857 if (retval) 853 if (retval)
858 return retval; 854 return retval;
859 855
860 if (capable(CAP_SETGID)) 856 if (capable(CAP_SETGID)) {
861 { 857 if (old_egid != gid) {
862 if(old_egid != gid)
863 {
864 current->mm->dumpable = suid_dumpable; 858 current->mm->dumpable = suid_dumpable;
865 smp_wmb(); 859 smp_wmb();
866 } 860 }
867 current->gid = current->egid = current->sgid = current->fsgid = gid; 861 current->gid = current->egid = current->sgid = current->fsgid = gid;
868 } 862 } else if ((gid == current->gid) || (gid == current->sgid)) {
869 else if ((gid == current->gid) || (gid == current->sgid)) 863 if (old_egid != gid) {
870 {
871 if(old_egid != gid)
872 {
873 current->mm->dumpable = suid_dumpable; 864 current->mm->dumpable = suid_dumpable;
874 smp_wmb(); 865 smp_wmb();
875 } 866 }
@@ -900,8 +891,7 @@ static int set_user(uid_t new_ruid, int dumpclear)
900 891
901 switch_uid(new_user); 892 switch_uid(new_user);
902 893
903 if(dumpclear) 894 if (dumpclear) {
904 {
905 current->mm->dumpable = suid_dumpable; 895 current->mm->dumpable = suid_dumpable;
906 smp_wmb(); 896 smp_wmb();
907 } 897 }
@@ -957,8 +947,7 @@ asmlinkage long sys_setreuid(uid_t ruid, uid_t euid)
957 if (new_ruid != old_ruid && set_user(new_ruid, new_euid != old_euid) < 0) 947 if (new_ruid != old_ruid && set_user(new_ruid, new_euid != old_euid) < 0)
958 return -EAGAIN; 948 return -EAGAIN;
959 949
960 if (new_euid != old_euid) 950 if (new_euid != old_euid) {
961 {
962 current->mm->dumpable = suid_dumpable; 951 current->mm->dumpable = suid_dumpable;
963 smp_wmb(); 952 smp_wmb();
964 } 953 }
@@ -1008,8 +997,7 @@ asmlinkage long sys_setuid(uid_t uid)
1008 } else if ((uid != current->uid) && (uid != new_suid)) 997 } else if ((uid != current->uid) && (uid != new_suid))
1009 return -EPERM; 998 return -EPERM;
1010 999
1011 if (old_euid != uid) 1000 if (old_euid != uid) {
1012 {
1013 current->mm->dumpable = suid_dumpable; 1001 current->mm->dumpable = suid_dumpable;
1014 smp_wmb(); 1002 smp_wmb();
1015 } 1003 }
@@ -1054,8 +1042,7 @@ asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
1054 return -EAGAIN; 1042 return -EAGAIN;
1055 } 1043 }
1056 if (euid != (uid_t) -1) { 1044 if (euid != (uid_t) -1) {
1057 if (euid != current->euid) 1045 if (euid != current->euid) {
1058 {
1059 current->mm->dumpable = suid_dumpable; 1046 current->mm->dumpable = suid_dumpable;
1060 smp_wmb(); 1047 smp_wmb();
1061 } 1048 }
@@ -1105,8 +1092,7 @@ asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
1105 return -EPERM; 1092 return -EPERM;
1106 } 1093 }
1107 if (egid != (gid_t) -1) { 1094 if (egid != (gid_t) -1) {
1108 if (egid != current->egid) 1095 if (egid != current->egid) {
1109 {
1110 current->mm->dumpable = suid_dumpable; 1096 current->mm->dumpable = suid_dumpable;
1111 smp_wmb(); 1097 smp_wmb();
1112 } 1098 }
@@ -1151,10 +1137,8 @@ asmlinkage long sys_setfsuid(uid_t uid)
1151 1137
1152 if (uid == current->uid || uid == current->euid || 1138 if (uid == current->uid || uid == current->euid ||
1153 uid == current->suid || uid == current->fsuid || 1139 uid == current->suid || uid == current->fsuid ||
1154 capable(CAP_SETUID)) 1140 capable(CAP_SETUID)) {
1155 { 1141 if (uid != old_fsuid) {
1156 if (uid != old_fsuid)
1157 {
1158 current->mm->dumpable = suid_dumpable; 1142 current->mm->dumpable = suid_dumpable;
1159 smp_wmb(); 1143 smp_wmb();
1160 } 1144 }
@@ -1182,10 +1166,8 @@ asmlinkage long sys_setfsgid(gid_t gid)
1182 1166
1183 if (gid == current->gid || gid == current->egid || 1167 if (gid == current->gid || gid == current->egid ||
1184 gid == current->sgid || gid == current->fsgid || 1168 gid == current->sgid || gid == current->fsgid ||
1185 capable(CAP_SETGID)) 1169 capable(CAP_SETGID)) {
1186 { 1170 if (gid != old_fsgid) {
1187 if (gid != old_fsgid)
1188 {
1189 current->mm->dumpable = suid_dumpable; 1171 current->mm->dumpable = suid_dumpable;
1190 smp_wmb(); 1172 smp_wmb();
1191 } 1173 }
@@ -1321,9 +1303,9 @@ out:
1321 1303
1322asmlinkage long sys_getpgid(pid_t pid) 1304asmlinkage long sys_getpgid(pid_t pid)
1323{ 1305{
1324 if (!pid) { 1306 if (!pid)
1325 return process_group(current); 1307 return process_group(current);
1326 } else { 1308 else {
1327 int retval; 1309 int retval;
1328 struct task_struct *p; 1310 struct task_struct *p;
1329 1311
@@ -1353,9 +1335,9 @@ asmlinkage long sys_getpgrp(void)
1353 1335
1354asmlinkage long sys_getsid(pid_t pid) 1336asmlinkage long sys_getsid(pid_t pid)
1355{ 1337{
1356 if (!pid) { 1338 if (!pid)
1357 return current->signal->session; 1339 return current->signal->session;
1358 } else { 1340 else {
1359 int retval; 1341 int retval;
1360 struct task_struct *p; 1342 struct task_struct *p;
1361 1343
@@ -1363,7 +1345,7 @@ asmlinkage long sys_getsid(pid_t pid)
1363 p = find_task_by_pid(pid); 1345 p = find_task_by_pid(pid);
1364 1346
1365 retval = -ESRCH; 1347 retval = -ESRCH;
1366 if(p) { 1348 if (p) {
1367 retval = security_task_getsid(p); 1349 retval = security_task_getsid(p);
1368 if (!retval) 1350 if (!retval)
1369 retval = p->signal->session; 1351 retval = p->signal->session;
@@ -1431,9 +1413,9 @@ struct group_info *groups_alloc(int gidsetsize)
1431 group_info->nblocks = nblocks; 1413 group_info->nblocks = nblocks;
1432 atomic_set(&group_info->usage, 1); 1414 atomic_set(&group_info->usage, 1);
1433 1415
1434 if (gidsetsize <= NGROUPS_SMALL) { 1416 if (gidsetsize <= NGROUPS_SMALL)
1435 group_info->blocks[0] = group_info->small_block; 1417 group_info->blocks[0] = group_info->small_block;
1436 } else { 1418 else {
1437 for (i = 0; i < nblocks; i++) { 1419 for (i = 0; i < nblocks; i++) {
1438 gid_t *b; 1420 gid_t *b;
1439 b = (void *)__get_free_page(GFP_USER); 1421 b = (void *)__get_free_page(GFP_USER);
@@ -1489,7 +1471,7 @@ static int groups_to_user(gid_t __user *grouplist,
1489/* fill a group_info from a user-space array - it must be allocated already */ 1471/* fill a group_info from a user-space array - it must be allocated already */
1490static int groups_from_user(struct group_info *group_info, 1472static int groups_from_user(struct group_info *group_info,
1491 gid_t __user *grouplist) 1473 gid_t __user *grouplist)
1492 { 1474{
1493 int i; 1475 int i;
1494 int count = group_info->ngroups; 1476 int count = group_info->ngroups;
1495 1477
@@ -1647,9 +1629,8 @@ asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist)
1647int in_group_p(gid_t grp) 1629int in_group_p(gid_t grp)
1648{ 1630{
1649 int retval = 1; 1631 int retval = 1;
1650 if (grp != current->fsgid) { 1632 if (grp != current->fsgid)
1651 retval = groups_search(current->group_info, grp); 1633 retval = groups_search(current->group_info, grp);
1652 }
1653 return retval; 1634 return retval;
1654} 1635}
1655 1636
@@ -1658,9 +1639,8 @@ EXPORT_SYMBOL(in_group_p);
1658int in_egroup_p(gid_t grp) 1639int in_egroup_p(gid_t grp)
1659{ 1640{
1660 int retval = 1; 1641 int retval = 1;
1661 if (grp != current->egid) { 1642 if (grp != current->egid)
1662 retval = groups_search(current->group_info, grp); 1643 retval = groups_search(current->group_info, grp);
1663 }
1664 return retval; 1644 return retval;
1665} 1645}
1666 1646
@@ -1775,9 +1755,9 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
1775 task_lock(current->group_leader); 1755 task_lock(current->group_leader);
1776 x = current->signal->rlim[resource]; 1756 x = current->signal->rlim[resource];
1777 task_unlock(current->group_leader); 1757 task_unlock(current->group_leader);
1778 if(x.rlim_cur > 0x7FFFFFFF) 1758 if (x.rlim_cur > 0x7FFFFFFF)
1779 x.rlim_cur = 0x7FFFFFFF; 1759 x.rlim_cur = 0x7FFFFFFF;
1780 if(x.rlim_max > 0x7FFFFFFF) 1760 if (x.rlim_max > 0x7FFFFFFF)
1781 x.rlim_max = 0x7FFFFFFF; 1761 x.rlim_max = 0x7FFFFFFF;
1782 return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0; 1762 return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
1783} 1763}