aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/msg.h2
-rw-r--r--include/linux/shm.h2
-rw-r--r--ipc/compat.c10
-rw-r--r--ipc/compat_mq.c2
-rw-r--r--ipc/ipc_sysctl.c14
-rw-r--r--ipc/mqueue.c16
-rw-r--r--ipc/msg.c18
-rw-r--r--ipc/sem.c96
-rw-r--r--ipc/shm.c32
-rw-r--r--ipc/util.c24
-rw-r--r--ipc/util.h14
11 files changed, 115 insertions, 115 deletions
diff --git a/include/linux/msg.h b/include/linux/msg.h
index e21f9d44307f..f3f302f9c197 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -9,7 +9,7 @@ struct msg_msg {
9 struct list_head m_list; 9 struct list_head m_list;
10 long m_type; 10 long m_type;
11 size_t m_ts; /* message text size */ 11 size_t m_ts; /* message text size */
12 struct msg_msgseg* next; 12 struct msg_msgseg *next;
13 void *security; 13 void *security;
14 /* the actual message follows immediately */ 14 /* the actual message follows immediately */
15}; 15};
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 429c1995d756..1e2cd2e6b540 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -9,7 +9,7 @@
9struct shmid_kernel /* private to the kernel */ 9struct shmid_kernel /* private to the kernel */
10{ 10{
11 struct kern_ipc_perm shm_perm; 11 struct kern_ipc_perm shm_perm;
12 struct file * shm_file; 12 struct file *shm_file;
13 unsigned long shm_nattch; 13 unsigned long shm_nattch;
14 unsigned long shm_segsz; 14 unsigned long shm_segsz;
15 time_t shm_atim; 15 time_t shm_atim;
diff --git a/ipc/compat.c b/ipc/compat.c
index 892f6585dd60..ed0530beef0b 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -197,7 +197,7 @@ static inline int __put_compat_ipc_perm(struct ipc64_perm *p,
197static inline int get_compat_semid64_ds(struct semid64_ds *s64, 197static inline int get_compat_semid64_ds(struct semid64_ds *s64,
198 struct compat_semid64_ds __user *up64) 198 struct compat_semid64_ds __user *up64)
199{ 199{
200 if (!access_ok (VERIFY_READ, up64, sizeof(*up64))) 200 if (!access_ok(VERIFY_READ, up64, sizeof(*up64)))
201 return -EFAULT; 201 return -EFAULT;
202 return __get_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm); 202 return __get_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm);
203} 203}
@@ -205,7 +205,7 @@ static inline int get_compat_semid64_ds(struct semid64_ds *s64,
205static inline int get_compat_semid_ds(struct semid64_ds *s, 205static inline int get_compat_semid_ds(struct semid64_ds *s,
206 struct compat_semid_ds __user *up) 206 struct compat_semid_ds __user *up)
207{ 207{
208 if (!access_ok (VERIFY_READ, up, sizeof(*up))) 208 if (!access_ok(VERIFY_READ, up, sizeof(*up)))
209 return -EFAULT; 209 return -EFAULT;
210 return __get_compat_ipc_perm(&s->sem_perm, &up->sem_perm); 210 return __get_compat_ipc_perm(&s->sem_perm, &up->sem_perm);
211} 211}
@@ -215,7 +215,7 @@ static inline int put_compat_semid64_ds(struct semid64_ds *s64,
215{ 215{
216 int err; 216 int err;
217 217
218 if (!access_ok (VERIFY_WRITE, up64, sizeof(*up64))) 218 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64)))
219 return -EFAULT; 219 return -EFAULT;
220 err = __put_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm); 220 err = __put_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm);
221 err |= __put_user(s64->sem_otime, &up64->sem_otime); 221 err |= __put_user(s64->sem_otime, &up64->sem_otime);
@@ -229,7 +229,7 @@ static inline int put_compat_semid_ds(struct semid64_ds *s,
229{ 229{
230 int err; 230 int err;
231 231
232 if (!access_ok (VERIFY_WRITE, up, sizeof(*up))) 232 if (!access_ok(VERIFY_WRITE, up, sizeof(*up)))
233 return -EFAULT; 233 return -EFAULT;
234 err = __put_compat_ipc_perm(&s->sem_perm, &up->sem_perm); 234 err = __put_compat_ipc_perm(&s->sem_perm, &up->sem_perm);
235 err |= __put_user(s->sem_otime, &up->sem_otime); 235 err |= __put_user(s->sem_otime, &up->sem_otime);
@@ -376,7 +376,7 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
376 struct compat_ipc_kludge ipck; 376 struct compat_ipc_kludge ipck;
377 if (!uptr) 377 if (!uptr)
378 return -EINVAL; 378 return -EINVAL;
379 if (copy_from_user (&ipck, uptr, sizeof(ipck))) 379 if (copy_from_user(&ipck, uptr, sizeof(ipck)))
380 return -EFAULT; 380 return -EFAULT;
381 uptr = compat_ptr(ipck.msgp); 381 uptr = compat_ptr(ipck.msgp);
382 fifth = ipck.msgtyp; 382 fifth = ipck.msgtyp;
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
index 380ea4fe08e7..63d7c6de335b 100644
--- a/ipc/compat_mq.c
+++ b/ipc/compat_mq.c
@@ -64,7 +64,7 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name,
64 return sys_mq_open(u_name, oflag, mode, p); 64 return sys_mq_open(u_name, oflag, mode, p);
65} 65}
66 66
67static int compat_prepare_timeout(struct timespec __user * *p, 67static int compat_prepare_timeout(struct timespec __user **p,
68 const struct compat_timespec __user *u) 68 const struct compat_timespec __user *u)
69{ 69{
70 struct timespec ts; 70 struct timespec ts;
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index b0e99deb6d05..17028648cfeb 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -164,21 +164,21 @@ static struct ctl_table ipc_kern_table[] = {
164 { 164 {
165 .procname = "shmmax", 165 .procname = "shmmax",
166 .data = &init_ipc_ns.shm_ctlmax, 166 .data = &init_ipc_ns.shm_ctlmax,
167 .maxlen = sizeof (init_ipc_ns.shm_ctlmax), 167 .maxlen = sizeof(init_ipc_ns.shm_ctlmax),
168 .mode = 0644, 168 .mode = 0644,
169 .proc_handler = proc_ipc_doulongvec_minmax, 169 .proc_handler = proc_ipc_doulongvec_minmax,
170 }, 170 },
171 { 171 {
172 .procname = "shmall", 172 .procname = "shmall",
173 .data = &init_ipc_ns.shm_ctlall, 173 .data = &init_ipc_ns.shm_ctlall,
174 .maxlen = sizeof (init_ipc_ns.shm_ctlall), 174 .maxlen = sizeof(init_ipc_ns.shm_ctlall),
175 .mode = 0644, 175 .mode = 0644,
176 .proc_handler = proc_ipc_doulongvec_minmax, 176 .proc_handler = proc_ipc_doulongvec_minmax,
177 }, 177 },
178 { 178 {
179 .procname = "shmmni", 179 .procname = "shmmni",
180 .data = &init_ipc_ns.shm_ctlmni, 180 .data = &init_ipc_ns.shm_ctlmni,
181 .maxlen = sizeof (init_ipc_ns.shm_ctlmni), 181 .maxlen = sizeof(init_ipc_ns.shm_ctlmni),
182 .mode = 0644, 182 .mode = 0644,
183 .proc_handler = proc_ipc_dointvec, 183 .proc_handler = proc_ipc_dointvec,
184 }, 184 },
@@ -194,7 +194,7 @@ static struct ctl_table ipc_kern_table[] = {
194 { 194 {
195 .procname = "msgmax", 195 .procname = "msgmax",
196 .data = &init_ipc_ns.msg_ctlmax, 196 .data = &init_ipc_ns.msg_ctlmax,
197 .maxlen = sizeof (init_ipc_ns.msg_ctlmax), 197 .maxlen = sizeof(init_ipc_ns.msg_ctlmax),
198 .mode = 0644, 198 .mode = 0644,
199 .proc_handler = proc_ipc_dointvec_minmax, 199 .proc_handler = proc_ipc_dointvec_minmax,
200 .extra1 = &zero, 200 .extra1 = &zero,
@@ -203,7 +203,7 @@ static struct ctl_table ipc_kern_table[] = {
203 { 203 {
204 .procname = "msgmni", 204 .procname = "msgmni",
205 .data = &init_ipc_ns.msg_ctlmni, 205 .data = &init_ipc_ns.msg_ctlmni,
206 .maxlen = sizeof (init_ipc_ns.msg_ctlmni), 206 .maxlen = sizeof(init_ipc_ns.msg_ctlmni),
207 .mode = 0644, 207 .mode = 0644,
208 .proc_handler = proc_ipc_callback_dointvec_minmax, 208 .proc_handler = proc_ipc_callback_dointvec_minmax,
209 .extra1 = &zero, 209 .extra1 = &zero,
@@ -212,7 +212,7 @@ static struct ctl_table ipc_kern_table[] = {
212 { 212 {
213 .procname = "msgmnb", 213 .procname = "msgmnb",
214 .data = &init_ipc_ns.msg_ctlmnb, 214 .data = &init_ipc_ns.msg_ctlmnb,
215 .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), 215 .maxlen = sizeof(init_ipc_ns.msg_ctlmnb),
216 .mode = 0644, 216 .mode = 0644,
217 .proc_handler = proc_ipc_dointvec_minmax, 217 .proc_handler = proc_ipc_dointvec_minmax,
218 .extra1 = &zero, 218 .extra1 = &zero,
@@ -221,7 +221,7 @@ static struct ctl_table ipc_kern_table[] = {
221 { 221 {
222 .procname = "sem", 222 .procname = "sem",
223 .data = &init_ipc_ns.sem_ctls, 223 .data = &init_ipc_ns.sem_ctls,
224 .maxlen = 4*sizeof (int), 224 .maxlen = 4*sizeof(int),
225 .mode = 0644, 225 .mode = 0644,
226 .proc_handler = proc_ipc_dointvec, 226 .proc_handler = proc_ipc_dointvec,
227 }, 227 },
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 95827ce2f3c7..bb36aaeb58a0 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Spinlocks: Mohamed Abbas (abbas.mohamed@intel.com) 7 * Spinlocks: Mohamed Abbas (abbas.mohamed@intel.com)
8 * Lockless receive & send, fd based notify: 8 * Lockless receive & send, fd based notify:
9 * Manfred Spraul (manfred@colorfullife.com) 9 * Manfred Spraul (manfred@colorfullife.com)
10 * 10 *
11 * Audit: George Wilson (ltcgcw@us.ibm.com) 11 * Audit: George Wilson (ltcgcw@us.ibm.com)
12 * 12 *
@@ -73,7 +73,7 @@ struct mqueue_inode_info {
73 struct mq_attr attr; 73 struct mq_attr attr;
74 74
75 struct sigevent notify; 75 struct sigevent notify;
76 struct pid* notify_owner; 76 struct pid *notify_owner;
77 struct user_namespace *notify_user_ns; 77 struct user_namespace *notify_user_ns;
78 struct user_struct *user; /* user who created, for accounting */ 78 struct user_struct *user; /* user who created, for accounting */
79 struct sock *notify_sock; 79 struct sock *notify_sock;
@@ -92,7 +92,7 @@ static void remove_notification(struct mqueue_inode_info *info);
92 92
93static struct kmem_cache *mqueue_inode_cachep; 93static struct kmem_cache *mqueue_inode_cachep;
94 94
95static struct ctl_table_header * mq_sysctl_table; 95static struct ctl_table_header *mq_sysctl_table;
96 96
97static inline struct mqueue_inode_info *MQUEUE_I(struct inode *inode) 97static inline struct mqueue_inode_info *MQUEUE_I(struct inode *inode)
98{ 98{
@@ -466,13 +466,13 @@ out_unlock:
466 466
467static int mqueue_unlink(struct inode *dir, struct dentry *dentry) 467static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
468{ 468{
469 struct inode *inode = dentry->d_inode; 469 struct inode *inode = dentry->d_inode;
470 470
471 dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; 471 dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME;
472 dir->i_size -= DIRENT_SIZE; 472 dir->i_size -= DIRENT_SIZE;
473 drop_nlink(inode); 473 drop_nlink(inode);
474 dput(dentry); 474 dput(dentry);
475 return 0; 475 return 0;
476} 476}
477 477
478/* 478/*
@@ -622,7 +622,7 @@ static struct ext_wait_queue *wq_get_first_waiter(
622 622
623static inline void set_cookie(struct sk_buff *skb, char code) 623static inline void set_cookie(struct sk_buff *skb, char code)
624{ 624{
625 ((char*)skb->data)[NOTIFY_COOKIE_LEN-1] = code; 625 ((char *)skb->data)[NOTIFY_COOKIE_LEN-1] = code;
626} 626}
627 627
628/* 628/*
diff --git a/ipc/msg.c b/ipc/msg.c
index 8983ea57d970..4377f4a45625 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -318,7 +318,7 @@ SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
318static inline unsigned long 318static inline unsigned long
319copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version) 319copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
320{ 320{
321 switch(version) { 321 switch (version) {
322 case IPC_64: 322 case IPC_64:
323 return copy_to_user(buf, in, sizeof(*in)); 323 return copy_to_user(buf, in, sizeof(*in));
324 case IPC_OLD: 324 case IPC_OLD:
@@ -363,7 +363,7 @@ copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
363static inline unsigned long 363static inline unsigned long
364copy_msqid_from_user(struct msqid64_ds *out, void __user *buf, int version) 364copy_msqid_from_user(struct msqid64_ds *out, void __user *buf, int version)
365{ 365{
366 switch(version) { 366 switch (version) {
367 case IPC_64: 367 case IPC_64:
368 if (copy_from_user(out, buf, sizeof(*out))) 368 if (copy_from_user(out, buf, sizeof(*out)))
369 return -EFAULT; 369 return -EFAULT;
@@ -375,9 +375,9 @@ copy_msqid_from_user(struct msqid64_ds *out, void __user *buf, int version)
375 if (copy_from_user(&tbuf_old, buf, sizeof(tbuf_old))) 375 if (copy_from_user(&tbuf_old, buf, sizeof(tbuf_old)))
376 return -EFAULT; 376 return -EFAULT;
377 377
378 out->msg_perm.uid = tbuf_old.msg_perm.uid; 378 out->msg_perm.uid = tbuf_old.msg_perm.uid;
379 out->msg_perm.gid = tbuf_old.msg_perm.gid; 379 out->msg_perm.gid = tbuf_old.msg_perm.gid;
380 out->msg_perm.mode = tbuf_old.msg_perm.mode; 380 out->msg_perm.mode = tbuf_old.msg_perm.mode;
381 381
382 if (tbuf_old.msg_qbytes == 0) 382 if (tbuf_old.msg_qbytes == 0)
383 out->msg_qbytes = tbuf_old.msg_lqbytes; 383 out->msg_qbytes = tbuf_old.msg_lqbytes;
@@ -606,13 +606,13 @@ SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
606 606
607static int testmsg(struct msg_msg *msg, long type, int mode) 607static int testmsg(struct msg_msg *msg, long type, int mode)
608{ 608{
609 switch(mode) 609 switch (mode)
610 { 610 {
611 case SEARCH_ANY: 611 case SEARCH_ANY:
612 case SEARCH_NUMBER: 612 case SEARCH_NUMBER:
613 return 1; 613 return 1;
614 case SEARCH_LESSEQUAL: 614 case SEARCH_LESSEQUAL:
615 if (msg->m_type <=type) 615 if (msg->m_type <= type)
616 return 1; 616 return 1;
617 break; 617 break;
618 case SEARCH_EQUAL: 618 case SEARCH_EQUAL:
@@ -984,7 +984,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl
984 * wake_up_process(). There is a race with exit(), see 984 * wake_up_process(). There is a race with exit(), see
985 * ipc/mqueue.c for the details. 985 * ipc/mqueue.c for the details.
986 */ 986 */
987 msg = (struct msg_msg*)msr_d.r_msg; 987 msg = (struct msg_msg *)msr_d.r_msg;
988 while (msg == NULL) { 988 while (msg == NULL) {
989 cpu_relax(); 989 cpu_relax();
990 msg = (struct msg_msg *)msr_d.r_msg; 990 msg = (struct msg_msg *)msr_d.r_msg;
@@ -1005,7 +1005,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl
1005 /* Lockless receive, part 4: 1005 /* Lockless receive, part 4:
1006 * Repeat test after acquiring the spinlock. 1006 * Repeat test after acquiring the spinlock.
1007 */ 1007 */
1008 msg = (struct msg_msg*)msr_d.r_msg; 1008 msg = (struct msg_msg *)msr_d.r_msg;
1009 if (msg != ERR_PTR(-EAGAIN)) 1009 if (msg != ERR_PTR(-EAGAIN))
1010 goto out_unlock0; 1010 goto out_unlock0;
1011 1011
diff --git a/ipc/sem.c b/ipc/sem.c
index 160fbb3390bb..c40876b5b002 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -188,7 +188,7 @@ void sem_exit_ns(struct ipc_namespace *ns)
188} 188}
189#endif 189#endif
190 190
191void __init sem_init (void) 191void __init sem_init(void)
192{ 192{
193 sem_init_ns(&init_ipc_ns); 193 sem_init_ns(&init_ipc_ns);
194 ipc_init_proc_interface("sysvipc/sem", 194 ipc_init_proc_interface("sysvipc/sem",
@@ -445,11 +445,11 @@ static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s)
445 * * call wake_up_process 445 * * call wake_up_process
446 * * set queue.status to the final value. 446 * * set queue.status to the final value.
447 * - the previously blocked thread checks queue.status: 447 * - the previously blocked thread checks queue.status:
448 * * if it's IN_WAKEUP, then it must wait until the value changes 448 * * if it's IN_WAKEUP, then it must wait until the value changes
449 * * if it's not -EINTR, then the operation was completed by 449 * * if it's not -EINTR, then the operation was completed by
450 * update_queue. semtimedop can return queue.status without 450 * update_queue. semtimedop can return queue.status without
451 * performing any operation on the sem array. 451 * performing any operation on the sem array.
452 * * otherwise it must acquire the spinlock and check what's up. 452 * * otherwise it must acquire the spinlock and check what's up.
453 * 453 *
454 * The two-stage algorithm is necessary to protect against the following 454 * The two-stage algorithm is necessary to protect against the following
455 * races: 455 * races:
@@ -491,12 +491,12 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
491 if (ns->used_sems + nsems > ns->sc_semmns) 491 if (ns->used_sems + nsems > ns->sc_semmns)
492 return -ENOSPC; 492 return -ENOSPC;
493 493
494 size = sizeof (*sma) + nsems * sizeof (struct sem); 494 size = sizeof(*sma) + nsems * sizeof(struct sem);
495 sma = ipc_rcu_alloc(size); 495 sma = ipc_rcu_alloc(size);
496 if (!sma) { 496 if (!sma) {
497 return -ENOMEM; 497 return -ENOMEM;
498 } 498 }
499 memset (sma, 0, size); 499 memset(sma, 0, size);
500 500
501 sma->sem_perm.mode = (semflg & S_IRWXUGO); 501 sma->sem_perm.mode = (semflg & S_IRWXUGO);
502 sma->sem_perm.key = key; 502 sma->sem_perm.key = key;
@@ -601,7 +601,7 @@ static int perform_atomic_semop(struct sem_array *sma, struct sembuf *sops,
601{ 601{
602 int result, sem_op; 602 int result, sem_op;
603 struct sembuf *sop; 603 struct sembuf *sop;
604 struct sem * curr; 604 struct sem *curr;
605 605
606 for (sop = sops; sop < sops + nsops; sop++) { 606 for (sop = sops; sop < sops + nsops; sop++) {
607 curr = sma->sem_base + sop->sem_num; 607 curr = sma->sem_base + sop->sem_num;
@@ -1000,21 +1000,21 @@ static void do_smart_update(struct sem_array *sma, struct sembuf *sops, int nsop
1000 * The counts we return here are a rough approximation, but still 1000 * The counts we return here are a rough approximation, but still
1001 * warrant that semncnt+semzcnt>0 if the task is on the pending queue. 1001 * warrant that semncnt+semzcnt>0 if the task is on the pending queue.
1002 */ 1002 */
1003static int count_semncnt (struct sem_array * sma, ushort semnum) 1003static int count_semncnt(struct sem_array *sma, ushort semnum)
1004{ 1004{
1005 int semncnt; 1005 int semncnt;
1006 struct sem_queue * q; 1006 struct sem_queue *q;
1007 1007
1008 semncnt = 0; 1008 semncnt = 0;
1009 list_for_each_entry(q, &sma->sem_base[semnum].pending_alter, list) { 1009 list_for_each_entry(q, &sma->sem_base[semnum].pending_alter, list) {
1010 struct sembuf * sops = q->sops; 1010 struct sembuf *sops = q->sops;
1011 BUG_ON(sops->sem_num != semnum); 1011 BUG_ON(sops->sem_num != semnum);
1012 if ((sops->sem_op < 0) && !(sops->sem_flg & IPC_NOWAIT)) 1012 if ((sops->sem_op < 0) && !(sops->sem_flg & IPC_NOWAIT))
1013 semncnt++; 1013 semncnt++;
1014 } 1014 }
1015 1015
1016 list_for_each_entry(q, &sma->pending_alter, list) { 1016 list_for_each_entry(q, &sma->pending_alter, list) {
1017 struct sembuf * sops = q->sops; 1017 struct sembuf *sops = q->sops;
1018 int nsops = q->nsops; 1018 int nsops = q->nsops;
1019 int i; 1019 int i;
1020 for (i = 0; i < nsops; i++) 1020 for (i = 0; i < nsops; i++)
@@ -1026,21 +1026,21 @@ static int count_semncnt (struct sem_array * sma, ushort semnum)
1026 return semncnt; 1026 return semncnt;
1027} 1027}
1028 1028
1029static int count_semzcnt (struct sem_array * sma, ushort semnum) 1029static int count_semzcnt(struct sem_array *sma, ushort semnum)
1030{ 1030{
1031 int semzcnt; 1031 int semzcnt;
1032 struct sem_queue * q; 1032 struct sem_queue *q;
1033 1033
1034 semzcnt = 0; 1034 semzcnt = 0;
1035 list_for_each_entry(q, &sma->sem_base[semnum].pending_const, list) { 1035 list_for_each_entry(q, &sma->sem_base[semnum].pending_const, list) {
1036 struct sembuf * sops = q->sops; 1036 struct sembuf *sops = q->sops;
1037 BUG_ON(sops->sem_num != semnum); 1037 BUG_ON(sops->sem_num != semnum);
1038 if ((sops->sem_op == 0) && !(sops->sem_flg & IPC_NOWAIT)) 1038 if ((sops->sem_op == 0) && !(sops->sem_flg & IPC_NOWAIT))
1039 semzcnt++; 1039 semzcnt++;
1040 } 1040 }
1041 1041
1042 list_for_each_entry(q, &sma->pending_const, list) { 1042 list_for_each_entry(q, &sma->pending_const, list) {
1043 struct sembuf * sops = q->sops; 1043 struct sembuf *sops = q->sops;
1044 int nsops = q->nsops; 1044 int nsops = q->nsops;
1045 int i; 1045 int i;
1046 for (i = 0; i < nsops; i++) 1046 for (i = 0; i < nsops; i++)
@@ -1110,7 +1110,7 @@ static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
1110 1110
1111static unsigned long copy_semid_to_user(void __user *buf, struct semid64_ds *in, int version) 1111static unsigned long copy_semid_to_user(void __user *buf, struct semid64_ds *in, int version)
1112{ 1112{
1113 switch(version) { 1113 switch (version) {
1114 case IPC_64: 1114 case IPC_64:
1115 return copy_to_user(buf, in, sizeof(*in)); 1115 return copy_to_user(buf, in, sizeof(*in));
1116 case IPC_OLD: 1116 case IPC_OLD:
@@ -1153,7 +1153,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
1153 int err; 1153 int err;
1154 struct sem_array *sma; 1154 struct sem_array *sma;
1155 1155
1156 switch(cmd) { 1156 switch (cmd) {
1157 case IPC_INFO: 1157 case IPC_INFO:
1158 case SEM_INFO: 1158 case SEM_INFO:
1159 { 1159 {
@@ -1164,7 +1164,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
1164 if (err) 1164 if (err)
1165 return err; 1165 return err;
1166 1166
1167 memset(&seminfo,0,sizeof(seminfo)); 1167 memset(&seminfo, 0, sizeof(seminfo));
1168 seminfo.semmni = ns->sc_semmni; 1168 seminfo.semmni = ns->sc_semmni;
1169 seminfo.semmns = ns->sc_semmns; 1169 seminfo.semmns = ns->sc_semmns;
1170 seminfo.semmsl = ns->sc_semmsl; 1170 seminfo.semmsl = ns->sc_semmsl;
@@ -1185,7 +1185,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
1185 up_read(&sem_ids(ns).rwsem); 1185 up_read(&sem_ids(ns).rwsem);
1186 if (copy_to_user(p, &seminfo, sizeof(struct seminfo))) 1186 if (copy_to_user(p, &seminfo, sizeof(struct seminfo)))
1187 return -EFAULT; 1187 return -EFAULT;
1188 return (max_id < 0) ? 0: max_id; 1188 return (max_id < 0) ? 0 : max_id;
1189 } 1189 }
1190 case IPC_STAT: 1190 case IPC_STAT:
1191 case SEM_STAT: 1191 case SEM_STAT:
@@ -1241,7 +1241,7 @@ static int semctl_setval(struct ipc_namespace *ns, int semid, int semnum,
1241{ 1241{
1242 struct sem_undo *un; 1242 struct sem_undo *un;
1243 struct sem_array *sma; 1243 struct sem_array *sma;
1244 struct sem* curr; 1244 struct sem *curr;
1245 int err; 1245 int err;
1246 struct list_head tasks; 1246 struct list_head tasks;
1247 int val; 1247 int val;
@@ -1311,10 +1311,10 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1311 int cmd, void __user *p) 1311 int cmd, void __user *p)
1312{ 1312{
1313 struct sem_array *sma; 1313 struct sem_array *sma;
1314 struct sem* curr; 1314 struct sem *curr;
1315 int err, nsems; 1315 int err, nsems;
1316 ushort fast_sem_io[SEMMSL_FAST]; 1316 ushort fast_sem_io[SEMMSL_FAST];
1317 ushort* sem_io = fast_sem_io; 1317 ushort *sem_io = fast_sem_io;
1318 struct list_head tasks; 1318 struct list_head tasks;
1319 1319
1320 INIT_LIST_HEAD(&tasks); 1320 INIT_LIST_HEAD(&tasks);
@@ -1348,7 +1348,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1348 err = -EIDRM; 1348 err = -EIDRM;
1349 goto out_unlock; 1349 goto out_unlock;
1350 } 1350 }
1351 if(nsems > SEMMSL_FAST) { 1351 if (nsems > SEMMSL_FAST) {
1352 if (!ipc_rcu_getref(sma)) { 1352 if (!ipc_rcu_getref(sma)) {
1353 err = -EIDRM; 1353 err = -EIDRM;
1354 goto out_unlock; 1354 goto out_unlock;
@@ -1356,7 +1356,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1356 sem_unlock(sma, -1); 1356 sem_unlock(sma, -1);
1357 rcu_read_unlock(); 1357 rcu_read_unlock();
1358 sem_io = ipc_alloc(sizeof(ushort)*nsems); 1358 sem_io = ipc_alloc(sizeof(ushort)*nsems);
1359 if(sem_io == NULL) { 1359 if (sem_io == NULL) {
1360 ipc_rcu_putref(sma, ipc_rcu_free); 1360 ipc_rcu_putref(sma, ipc_rcu_free);
1361 return -ENOMEM; 1361 return -ENOMEM;
1362 } 1362 }
@@ -1373,7 +1373,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1373 sem_unlock(sma, -1); 1373 sem_unlock(sma, -1);
1374 rcu_read_unlock(); 1374 rcu_read_unlock();
1375 err = 0; 1375 err = 0;
1376 if(copy_to_user(array, sem_io, nsems*sizeof(ushort))) 1376 if (copy_to_user(array, sem_io, nsems*sizeof(ushort)))
1377 err = -EFAULT; 1377 err = -EFAULT;
1378 goto out_free; 1378 goto out_free;
1379 } 1379 }
@@ -1388,15 +1388,15 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1388 } 1388 }
1389 rcu_read_unlock(); 1389 rcu_read_unlock();
1390 1390
1391 if(nsems > SEMMSL_FAST) { 1391 if (nsems > SEMMSL_FAST) {
1392 sem_io = ipc_alloc(sizeof(ushort)*nsems); 1392 sem_io = ipc_alloc(sizeof(ushort)*nsems);
1393 if(sem_io == NULL) { 1393 if (sem_io == NULL) {
1394 ipc_rcu_putref(sma, ipc_rcu_free); 1394 ipc_rcu_putref(sma, ipc_rcu_free);
1395 return -ENOMEM; 1395 return -ENOMEM;
1396 } 1396 }
1397 } 1397 }
1398 1398
1399 if (copy_from_user (sem_io, p, nsems*sizeof(ushort))) { 1399 if (copy_from_user(sem_io, p, nsems*sizeof(ushort))) {
1400 ipc_rcu_putref(sma, ipc_rcu_free); 1400 ipc_rcu_putref(sma, ipc_rcu_free);
1401 err = -EFAULT; 1401 err = -EFAULT;
1402 goto out_free; 1402 goto out_free;
@@ -1451,10 +1451,10 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1451 err = curr->sempid; 1451 err = curr->sempid;
1452 goto out_unlock; 1452 goto out_unlock;
1453 case GETNCNT: 1453 case GETNCNT:
1454 err = count_semncnt(sma,semnum); 1454 err = count_semncnt(sma, semnum);
1455 goto out_unlock; 1455 goto out_unlock;
1456 case GETZCNT: 1456 case GETZCNT:
1457 err = count_semzcnt(sma,semnum); 1457 err = count_semzcnt(sma, semnum);
1458 goto out_unlock; 1458 goto out_unlock;
1459 } 1459 }
1460 1460
@@ -1464,7 +1464,7 @@ out_rcu_wakeup:
1464 rcu_read_unlock(); 1464 rcu_read_unlock();
1465 wake_up_sem_queue_do(&tasks); 1465 wake_up_sem_queue_do(&tasks);
1466out_free: 1466out_free:
1467 if(sem_io != fast_sem_io) 1467 if (sem_io != fast_sem_io)
1468 ipc_free(sem_io, sizeof(ushort)*nsems); 1468 ipc_free(sem_io, sizeof(ushort)*nsems);
1469 return err; 1469 return err;
1470} 1470}
@@ -1472,7 +1472,7 @@ out_free:
1472static inline unsigned long 1472static inline unsigned long
1473copy_semid_from_user(struct semid64_ds *out, void __user *buf, int version) 1473copy_semid_from_user(struct semid64_ds *out, void __user *buf, int version)
1474{ 1474{
1475 switch(version) { 1475 switch (version) {
1476 case IPC_64: 1476 case IPC_64:
1477 if (copy_from_user(out, buf, sizeof(*out))) 1477 if (copy_from_user(out, buf, sizeof(*out)))
1478 return -EFAULT; 1478 return -EFAULT;
@@ -1481,7 +1481,7 @@ copy_semid_from_user(struct semid64_ds *out, void __user *buf, int version)
1481 { 1481 {
1482 struct semid_ds tbuf_old; 1482 struct semid_ds tbuf_old;
1483 1483
1484 if(copy_from_user(&tbuf_old, buf, sizeof(tbuf_old))) 1484 if (copy_from_user(&tbuf_old, buf, sizeof(tbuf_old)))
1485 return -EFAULT; 1485 return -EFAULT;
1486 1486
1487 out->sem_perm.uid = tbuf_old.sem_perm.uid; 1487 out->sem_perm.uid = tbuf_old.sem_perm.uid;
@@ -1508,7 +1508,7 @@ static int semctl_down(struct ipc_namespace *ns, int semid,
1508 struct semid64_ds semid64; 1508 struct semid64_ds semid64;
1509 struct kern_ipc_perm *ipcp; 1509 struct kern_ipc_perm *ipcp;
1510 1510
1511 if(cmd == IPC_SET) { 1511 if (cmd == IPC_SET) {
1512 if (copy_semid_from_user(&semid64, p, version)) 1512 if (copy_semid_from_user(&semid64, p, version))
1513 return -EFAULT; 1513 return -EFAULT;
1514 } 1514 }
@@ -1568,7 +1568,7 @@ SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg)
1568 version = ipc_parse_version(&cmd); 1568 version = ipc_parse_version(&cmd);
1569 ns = current->nsproxy->ipc_ns; 1569 ns = current->nsproxy->ipc_ns;
1570 1570
1571 switch(cmd) { 1571 switch (cmd) {
1572 case IPC_INFO: 1572 case IPC_INFO:
1573 case SEM_INFO: 1573 case SEM_INFO:
1574 case IPC_STAT: 1574 case IPC_STAT:
@@ -1636,7 +1636,7 @@ static struct sem_undo *lookup_undo(struct sem_undo_list *ulp, int semid)
1636{ 1636{
1637 struct sem_undo *un; 1637 struct sem_undo *un;
1638 1638
1639 assert_spin_locked(&ulp->lock); 1639 assert_spin_locked(&ulp->lock);
1640 1640
1641 un = __lookup_undo(ulp, semid); 1641 un = __lookup_undo(ulp, semid);
1642 if (un) { 1642 if (un) {
@@ -1672,7 +1672,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
1672 spin_lock(&ulp->lock); 1672 spin_lock(&ulp->lock);
1673 un = lookup_undo(ulp, semid); 1673 un = lookup_undo(ulp, semid);
1674 spin_unlock(&ulp->lock); 1674 spin_unlock(&ulp->lock);
1675 if (likely(un!=NULL)) 1675 if (likely(un != NULL))
1676 goto out; 1676 goto out;
1677 1677
1678 /* no undo structure around - allocate one. */ 1678 /* no undo structure around - allocate one. */
@@ -1767,7 +1767,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1767 int error = -EINVAL; 1767 int error = -EINVAL;
1768 struct sem_array *sma; 1768 struct sem_array *sma;
1769 struct sembuf fast_sops[SEMOPM_FAST]; 1769 struct sembuf fast_sops[SEMOPM_FAST];
1770 struct sembuf* sops = fast_sops, *sop; 1770 struct sembuf *sops = fast_sops, *sop;
1771 struct sem_undo *un; 1771 struct sem_undo *un;
1772 int undos = 0, alter = 0, max, locknum; 1772 int undos = 0, alter = 0, max, locknum;
1773 struct sem_queue queue; 1773 struct sem_queue queue;
@@ -1781,13 +1781,13 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1781 return -EINVAL; 1781 return -EINVAL;
1782 if (nsops > ns->sc_semopm) 1782 if (nsops > ns->sc_semopm)
1783 return -E2BIG; 1783 return -E2BIG;
1784 if(nsops > SEMOPM_FAST) { 1784 if (nsops > SEMOPM_FAST) {
1785 sops = kmalloc(sizeof(*sops)*nsops,GFP_KERNEL); 1785 sops = kmalloc(sizeof(*sops)*nsops, GFP_KERNEL);
1786 if(sops==NULL) 1786 if (sops == NULL)
1787 return -ENOMEM; 1787 return -ENOMEM;
1788 } 1788 }
1789 if (copy_from_user (sops, tsops, nsops * sizeof(*tsops))) { 1789 if (copy_from_user(sops, tsops, nsops * sizeof(*tsops))) {
1790 error=-EFAULT; 1790 error = -EFAULT;
1791 goto out_free; 1791 goto out_free;
1792 } 1792 }
1793 if (timeout) { 1793 if (timeout) {
@@ -1994,7 +1994,7 @@ out_rcu_wakeup:
1994 rcu_read_unlock(); 1994 rcu_read_unlock();
1995 wake_up_sem_queue_do(&tasks); 1995 wake_up_sem_queue_do(&tasks);
1996out_free: 1996out_free:
1997 if(sops != fast_sops) 1997 if (sops != fast_sops)
1998 kfree(sops); 1998 kfree(sops);
1999 return error; 1999 return error;
2000} 2000}
@@ -2103,7 +2103,7 @@ void exit_sem(struct task_struct *tsk)
2103 2103
2104 /* perform adjustments registered in un */ 2104 /* perform adjustments registered in un */
2105 for (i = 0; i < sma->sem_nsems; i++) { 2105 for (i = 0; i < sma->sem_nsems; i++) {
2106 struct sem * semaphore = &sma->sem_base[i]; 2106 struct sem *semaphore = &sma->sem_base[i];
2107 if (un->semadj[i]) { 2107 if (un->semadj[i]) {
2108 semaphore->semval += un->semadj[i]; 2108 semaphore->semval += un->semadj[i];
2109 /* 2109 /*
@@ -2117,7 +2117,7 @@ void exit_sem(struct task_struct *tsk)
2117 * Linux caps the semaphore value, both at 0 2117 * Linux caps the semaphore value, both at 0
2118 * and at SEMVMX. 2118 * and at SEMVMX.
2119 * 2119 *
2120 * Manfred <manfred@colorfullife.com> 2120 * Manfred <manfred@colorfullife.com>
2121 */ 2121 */
2122 if (semaphore->semval < 0) 2122 if (semaphore->semval < 0)
2123 semaphore->semval = 0; 2123 semaphore->semval = 0;
diff --git a/ipc/shm.c b/ipc/shm.c
index 1bc68f115842..88c59c1e026c 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -67,7 +67,7 @@ static const struct vm_operations_struct shm_vm_ops;
67static int newseg(struct ipc_namespace *, struct ipc_params *); 67static int newseg(struct ipc_namespace *, struct ipc_params *);
68static void shm_open(struct vm_area_struct *vma); 68static void shm_open(struct vm_area_struct *vma);
69static void shm_close(struct vm_area_struct *vma); 69static void shm_close(struct vm_area_struct *vma);
70static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp); 70static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp);
71#ifdef CONFIG_PROC_FS 71#ifdef CONFIG_PROC_FS
72static int sysvipc_shm_proc_show(struct seq_file *s, void *it); 72static int sysvipc_shm_proc_show(struct seq_file *s, void *it);
73#endif 73#endif
@@ -91,7 +91,7 @@ static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
91 struct shmid_kernel *shp; 91 struct shmid_kernel *shp;
92 shp = container_of(ipcp, struct shmid_kernel, shm_perm); 92 shp = container_of(ipcp, struct shmid_kernel, shm_perm);
93 93
94 if (shp->shm_nattch){ 94 if (shp->shm_nattch) {
95 shp->shm_perm.mode |= SHM_DEST; 95 shp->shm_perm.mode |= SHM_DEST;
96 /* Do not find it any more */ 96 /* Do not find it any more */
97 shp->shm_perm.key = IPC_PRIVATE; 97 shp->shm_perm.key = IPC_PRIVATE;
@@ -116,7 +116,7 @@ static int __init ipc_ns_init(void)
116 116
117pure_initcall(ipc_ns_init); 117pure_initcall(ipc_ns_init);
118 118
119void __init shm_init (void) 119void __init shm_init(void)
120{ 120{
121 ipc_init_proc_interface("sysvipc/shm", 121 ipc_init_proc_interface("sysvipc/shm",
122#if BITS_PER_LONG <= 32 122#if BITS_PER_LONG <= 32
@@ -248,7 +248,7 @@ static bool shm_may_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
248 */ 248 */
249static void shm_close(struct vm_area_struct *vma) 249static void shm_close(struct vm_area_struct *vma)
250{ 250{
251 struct file * file = vma->vm_file; 251 struct file *file = vma->vm_file;
252 struct shm_file_data *sfd = shm_file_data(file); 252 struct shm_file_data *sfd = shm_file_data(file);
253 struct shmid_kernel *shp; 253 struct shmid_kernel *shp;
254 struct ipc_namespace *ns = sfd->ns; 254 struct ipc_namespace *ns = sfd->ns;
@@ -379,7 +379,7 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
379} 379}
380#endif 380#endif
381 381
382static int shm_mmap(struct file * file, struct vm_area_struct * vma) 382static int shm_mmap(struct file *file, struct vm_area_struct *vma)
383{ 383{
384 struct shm_file_data *sfd = shm_file_data(file); 384 struct shm_file_data *sfd = shm_file_data(file);
385 int ret; 385 int ret;
@@ -486,7 +486,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
486 int error; 486 int error;
487 struct shmid_kernel *shp; 487 struct shmid_kernel *shp;
488 size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 488 size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
489 struct file * file; 489 struct file *file;
490 char name[13]; 490 char name[13];
491 int id; 491 int id;
492 vm_flags_t acctflag = 0; 492 vm_flags_t acctflag = 0;
@@ -512,7 +512,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
512 return error; 512 return error;
513 } 513 }
514 514
515 sprintf (name, "SYSV%08x", key); 515 sprintf(name, "SYSV%08x", key);
516 if (shmflg & SHM_HUGETLB) { 516 if (shmflg & SHM_HUGETLB) {
517 struct hstate *hs; 517 struct hstate *hs;
518 size_t hugesize; 518 size_t hugesize;
@@ -533,7 +533,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
533 } else { 533 } else {
534 /* 534 /*
535 * Do not allow no accounting for OVERCOMMIT_NEVER, even 535 * Do not allow no accounting for OVERCOMMIT_NEVER, even
536 * if it's asked for. 536 * if it's asked for.
537 */ 537 */
538 if ((shmflg & SHM_NORESERVE) && 538 if ((shmflg & SHM_NORESERVE) &&
539 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 539 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
@@ -628,7 +628,7 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
628 628
629static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version) 629static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version)
630{ 630{
631 switch(version) { 631 switch (version) {
632 case IPC_64: 632 case IPC_64:
633 return copy_to_user(buf, in, sizeof(*in)); 633 return copy_to_user(buf, in, sizeof(*in));
634 case IPC_OLD: 634 case IPC_OLD:
@@ -655,7 +655,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_
655static inline unsigned long 655static inline unsigned long
656copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version) 656copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version)
657{ 657{
658 switch(version) { 658 switch (version) {
659 case IPC_64: 659 case IPC_64:
660 if (copy_from_user(out, buf, sizeof(*out))) 660 if (copy_from_user(out, buf, sizeof(*out)))
661 return -EFAULT; 661 return -EFAULT;
@@ -680,14 +680,14 @@ copy_shmid_from_user(struct shmid64_ds *out, void __user *buf, int version)
680 680
681static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version) 681static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version)
682{ 682{
683 switch(version) { 683 switch (version) {
684 case IPC_64: 684 case IPC_64:
685 return copy_to_user(buf, in, sizeof(*in)); 685 return copy_to_user(buf, in, sizeof(*in));
686 case IPC_OLD: 686 case IPC_OLD:
687 { 687 {
688 struct shminfo out; 688 struct shminfo out;
689 689
690 if(in->shmmax > INT_MAX) 690 if (in->shmmax > INT_MAX)
691 out.shmmax = INT_MAX; 691 out.shmmax = INT_MAX;
692 else 692 else
693 out.shmmax = (int)in->shmmax; 693 out.shmmax = (int)in->shmmax;
@@ -846,14 +846,14 @@ static int shmctl_nolock(struct ipc_namespace *ns, int shmid,
846 shminfo.shmall = ns->shm_ctlall; 846 shminfo.shmall = ns->shm_ctlall;
847 847
848 shminfo.shmmin = SHMMIN; 848 shminfo.shmmin = SHMMIN;
849 if(copy_shminfo_to_user (buf, &shminfo, version)) 849 if (copy_shminfo_to_user(buf, &shminfo, version))
850 return -EFAULT; 850 return -EFAULT;
851 851
852 down_read(&shm_ids(ns).rwsem); 852 down_read(&shm_ids(ns).rwsem);
853 err = ipc_get_maxid(&shm_ids(ns)); 853 err = ipc_get_maxid(&shm_ids(ns));
854 up_read(&shm_ids(ns).rwsem); 854 up_read(&shm_ids(ns).rwsem);
855 855
856 if(err<0) 856 if (err < 0)
857 err = 0; 857 err = 0;
858 goto out; 858 goto out;
859 } 859 }
@@ -864,7 +864,7 @@ static int shmctl_nolock(struct ipc_namespace *ns, int shmid,
864 memset(&shm_info, 0, sizeof(shm_info)); 864 memset(&shm_info, 0, sizeof(shm_info));
865 down_read(&shm_ids(ns).rwsem); 865 down_read(&shm_ids(ns).rwsem);
866 shm_info.used_ids = shm_ids(ns).in_use; 866 shm_info.used_ids = shm_ids(ns).in_use;
867 shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp); 867 shm_get_stat(ns, &shm_info.shm_rss, &shm_info.shm_swp);
868 shm_info.shm_tot = ns->shm_tot; 868 shm_info.shm_tot = ns->shm_tot;
869 shm_info.swap_attempts = 0; 869 shm_info.swap_attempts = 0;
870 shm_info.swap_successes = 0; 870 shm_info.swap_successes = 0;
@@ -1047,7 +1047,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
1047 struct shmid_kernel *shp; 1047 struct shmid_kernel *shp;
1048 unsigned long addr; 1048 unsigned long addr;
1049 unsigned long size; 1049 unsigned long size;
1050 struct file * file; 1050 struct file *file;
1051 int err; 1051 int err;
1052 unsigned long flags; 1052 unsigned long flags;
1053 unsigned long prot; 1053 unsigned long prot;
diff --git a/ipc/util.c b/ipc/util.c
index 9dc67fa4308c..fdf03fa6869d 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -150,7 +150,7 @@ void ipc_init_ids(struct ipc_ids *ids)
150 if (seq_limit > USHRT_MAX) 150 if (seq_limit > USHRT_MAX)
151 ids->seq_max = USHRT_MAX; 151 ids->seq_max = USHRT_MAX;
152 else 152 else
153 ids->seq_max = seq_limit; 153 ids->seq_max = seq_limit;
154 } 154 }
155 155
156 idr_init(&ids->ipcs_idr); 156 idr_init(&ids->ipcs_idr);
@@ -227,7 +227,7 @@ static struct kern_ipc_perm *ipc_findkey(struct ipc_ids *ids, key_t key)
227} 227}
228 228
229/** 229/**
230 * ipc_get_maxid - get the last assigned id 230 * ipc_get_maxid - get the last assigned id
231 * @ids: IPC identifier set 231 * @ids: IPC identifier set
232 * 232 *
233 * Called with ipc_ids.rwsem held. 233 * Called with ipc_ids.rwsem held.
@@ -258,7 +258,7 @@ int ipc_get_maxid(struct ipc_ids *ids)
258} 258}
259 259
260/** 260/**
261 * ipc_addid - add an IPC identifier 261 * ipc_addid - add an IPC identifier
262 * @ids: IPC identifier set 262 * @ids: IPC identifier set
263 * @new: new IPC permission set 263 * @new: new IPC permission set
264 * @size: limit for the number of used ids 264 * @size: limit for the number of used ids
@@ -270,7 +270,7 @@ int ipc_get_maxid(struct ipc_ids *ids)
270 * 270 *
271 * Called with writer ipc_ids.rwsem held. 271 * Called with writer ipc_ids.rwsem held.
272 */ 272 */
273int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) 273int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int size)
274{ 274{
275 kuid_t euid; 275 kuid_t euid;
276 kgid_t egid; 276 kgid_t egid;
@@ -463,7 +463,7 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
463void *ipc_alloc(int size) 463void *ipc_alloc(int size)
464{ 464{
465 void *out; 465 void *out;
466 if(size > PAGE_SIZE) 466 if (size > PAGE_SIZE)
467 out = vmalloc(size); 467 out = vmalloc(size);
468 else 468 else
469 out = kmalloc(size, GFP_KERNEL); 469 out = kmalloc(size, GFP_KERNEL);
@@ -479,9 +479,9 @@ void *ipc_alloc(int size)
479 * used in the allocation call. 479 * used in the allocation call.
480 */ 480 */
481 481
482void ipc_free(void* ptr, int size) 482void ipc_free(void *ptr, int size)
483{ 483{
484 if(size > PAGE_SIZE) 484 if (size > PAGE_SIZE)
485 vfree(ptr); 485 vfree(ptr);
486 else 486 else
487 kfree(ptr); 487 kfree(ptr);
@@ -542,7 +542,7 @@ void ipc_rcu_free(struct rcu_head *head)
542 * Check user, group, other permissions for access 542 * Check user, group, other permissions for access
543 * to ipc resources. return 0 if allowed 543 * to ipc resources. return 0 if allowed
544 * 544 *
545 * @flag will most probably be 0 or S_...UGO from <linux/stat.h> 545 * @flag will most probably be 0 or S_...UGO from <linux/stat.h>
546 */ 546 */
547 547
548int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag) 548int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag)
@@ -581,7 +581,7 @@ int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag)
581 */ 581 */
582 582
583 583
584void kernel_to_ipc64_perm (struct kern_ipc_perm *in, struct ipc64_perm *out) 584void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out)
585{ 585{
586 out->key = in->key; 586 out->key = in->key;
587 out->uid = from_kuid_munged(current_user_ns(), in->uid); 587 out->uid = from_kuid_munged(current_user_ns(), in->uid);
@@ -601,7 +601,7 @@ void kernel_to_ipc64_perm (struct kern_ipc_perm *in, struct ipc64_perm *out)
601 * object and store it into the @out pointer. 601 * object and store it into the @out pointer.
602 */ 602 */
603 603
604void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out) 604void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out)
605{ 605{
606 out->key = in->key; 606 out->key = in->key;
607 SET_UID(out->uid, in->uid); 607 SET_UID(out->uid, in->uid);
@@ -787,7 +787,7 @@ err:
787 * just the command code. 787 * just the command code.
788 */ 788 */
789 789
790int ipc_parse_version (int *cmd) 790int ipc_parse_version(int *cmd)
791{ 791{
792 if (*cmd & IPC_64) { 792 if (*cmd & IPC_64) {
793 *cmd ^= IPC_64; 793 *cmd ^= IPC_64;
@@ -824,7 +824,7 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
824 if (total >= ids->in_use) 824 if (total >= ids->in_use)
825 return NULL; 825 return NULL;
826 826
827 for ( ; pos < IPCMNI; pos++) { 827 for (; pos < IPCMNI; pos++) {
828 ipc = idr_find(&ids->ipcs_idr, pos); 828 ipc = idr_find(&ids->ipcs_idr, pos);
829 if (ipc != NULL) { 829 if (ipc != NULL) {
830 *new_pos = pos + 1; 830 *new_pos = pos + 1;
diff --git a/ipc/util.h b/ipc/util.h
index a1cbc3aaf25a..d64db3e56f7d 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -15,9 +15,9 @@
15 15
16#define SEQ_MULTIPLIER (IPCMNI) 16#define SEQ_MULTIPLIER (IPCMNI)
17 17
18void sem_init (void); 18void sem_init(void);
19void msg_init (void); 19void msg_init(void);
20void shm_init (void); 20void shm_init(void);
21 21
22struct ipc_namespace; 22struct ipc_namespace;
23 23
@@ -116,8 +116,8 @@ int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flg);
116/* for rare, potentially huge allocations. 116/* for rare, potentially huge allocations.
117 * both function can sleep 117 * both function can sleep
118 */ 118 */
119void* ipc_alloc(int size); 119void *ipc_alloc(int size);
120void ipc_free(void* ptr, int size); 120void ipc_free(void *ptr, int size);
121 121
122/* 122/*
123 * For allocation that need to be freed by RCU. 123 * For allocation that need to be freed by RCU.
@@ -125,7 +125,7 @@ void ipc_free(void* ptr, int size);
125 * getref increases the refcount, the putref call that reduces the recount 125 * getref increases the refcount, the putref call that reduces the recount
126 * to 0 schedules the rcu destruction. Caller must guarantee locking. 126 * to 0 schedules the rcu destruction. Caller must guarantee locking.
127 */ 127 */
128void* ipc_rcu_alloc(int size); 128void *ipc_rcu_alloc(int size);
129int ipc_rcu_getref(void *ptr); 129int ipc_rcu_getref(void *ptr);
130void ipc_rcu_putref(void *ptr, void (*func)(struct rcu_head *head)); 130void ipc_rcu_putref(void *ptr, void (*func)(struct rcu_head *head));
131void ipc_rcu_free(struct rcu_head *head); 131void ipc_rcu_free(struct rcu_head *head);
@@ -144,7 +144,7 @@ struct kern_ipc_perm *ipcctl_pre_down_nolock(struct ipc_namespace *ns,
144 /* On IA-64, we always use the "64-bit version" of the IPC structures. */ 144 /* On IA-64, we always use the "64-bit version" of the IPC structures. */
145# define ipc_parse_version(cmd) IPC_64 145# define ipc_parse_version(cmd) IPC_64
146#else 146#else
147int ipc_parse_version (int *cmd); 147int ipc_parse_version(int *cmd);
148#endif 148#endif
149 149
150extern void free_msg(struct msg_msg *msg); 150extern void free_msg(struct msg_msg *msg);