Commit 5b80fe8b authored by Paolo Ciarrocchi's avatar Paolo Ciarrocchi Committed by Ingo Molnar

x86: coding style fixes to arch/x86/kernel/sys_i386_32.c

Before:
total: 16 errors, 25 warnings, 246 lines checked

After:
total: 0 errors, 7 warnings, 246 lines checked

Compile tested.

paolo@paolo-desktop:/tmp$ size sys*
   text    data     bss     dec     hex filename
   1209       0       0    1209     4b9 sys_i386_32.o.after
   1209       0       0    1209     4b9 sys_i386_32.o.before

paolo@paolo-desktop:/tmp$ md5sum sys*
6144f6d6ce7342c3e192681a1ccaa1c1  sys_i386_32.o.after
6144f6d6ce7342c3e192681a1ccaa1c1  sys_i386_32.o.before
Signed-off-by: default avatarPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7058b061
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/ipc.h> #include <linux/ipc.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <asm/unistd.h> #include <linux/unistd.h>
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long prot, unsigned long flags,
...@@ -103,7 +103,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg) ...@@ -103,7 +103,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg)
* *
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage int sys_ipc (uint call, int first, int second, asmlinkage int sys_ipc(uint call, int first, int second,
int third, void __user *ptr, long fifth) int third, void __user *ptr, long fifth)
{ {
int version, ret; int version, ret;
...@@ -113,24 +113,24 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -113,24 +113,24 @@ asmlinkage int sys_ipc (uint call, int first, int second,
switch (call) { switch (call) {
case SEMOP: case SEMOP:
return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL); return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
case SEMTIMEDOP: case SEMTIMEDOP:
return sys_semtimedop(first, (struct sembuf __user *)ptr, second, return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
(const struct timespec __user *)fifth); (const struct timespec __user *)fifth);
case SEMGET: case SEMGET:
return sys_semget (first, second, third); return sys_semget(first, second, third);
case SEMCTL: { case SEMCTL: {
union semun fourth; union semun fourth;
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (get_user(fourth.__pad, (void __user * __user *) ptr)) if (get_user(fourth.__pad, (void __user * __user *) ptr))
return -EFAULT; return -EFAULT;
return sys_semctl (first, second, third, fourth); return sys_semctl(first, second, third, fourth);
} }
case MSGSND: case MSGSND:
return sys_msgsnd (first, (struct msgbuf __user *) ptr, return sys_msgsnd(first, (struct msgbuf __user *) ptr,
second, third); second, third);
case MSGRCV: case MSGRCV:
switch (version) { switch (version) {
...@@ -138,45 +138,45 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -138,45 +138,45 @@ asmlinkage int sys_ipc (uint call, int first, int second,
struct ipc_kludge tmp; struct ipc_kludge tmp;
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (copy_from_user(&tmp, if (copy_from_user(&tmp,
(struct ipc_kludge __user *) ptr, (struct ipc_kludge __user *) ptr,
sizeof (tmp))) sizeof(tmp)))
return -EFAULT; return -EFAULT;
return sys_msgrcv (first, tmp.msgp, second, return sys_msgrcv(first, tmp.msgp, second,
tmp.msgtyp, third); tmp.msgtyp, third);
} }
default: default:
return sys_msgrcv (first, return sys_msgrcv(first,
(struct msgbuf __user *) ptr, (struct msgbuf __user *) ptr,
second, fifth, third); second, fifth, third);
} }
case MSGGET: case MSGGET:
return sys_msgget ((key_t) first, second); return sys_msgget((key_t) first, second);
case MSGCTL: case MSGCTL:
return sys_msgctl (first, second, (struct msqid_ds __user *) ptr); return sys_msgctl(first, second, (struct msqid_ds __user *) ptr);
case SHMAT: case SHMAT:
switch (version) { switch (version) {
default: { default: {
ulong raddr; ulong raddr;
ret = do_shmat (first, (char __user *) ptr, second, &raddr); ret = do_shmat(first, (char __user *) ptr, second, &raddr);
if (ret) if (ret)
return ret; return ret;
return put_user (raddr, (ulong __user *) third); return put_user(raddr, (ulong __user *) third);
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
if (!segment_eq(get_fs(), get_ds())) if (!segment_eq(get_fs(), get_ds()))
return -EINVAL; return -EINVAL;
/* The "(ulong *) third" is valid _only_ because of the kernel segment thing */ /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
return do_shmat (first, (char __user *) ptr, second, (ulong *) third); return do_shmat(first, (char __user *) ptr, second, (ulong *) third);
} }
case SHMDT: case SHMDT:
return sys_shmdt ((char __user *)ptr); return sys_shmdt((char __user *)ptr);
case SHMGET: case SHMGET:
return sys_shmget (first, second, third); return sys_shmget(first, second, third);
case SHMCTL: case SHMCTL:
return sys_shmctl (first, second, return sys_shmctl(first, second,
(struct shmid_ds __user *) ptr); (struct shmid_ds __user *) ptr);
default: default:
return -ENOSYS; return -ENOSYS;
...@@ -186,28 +186,28 @@ asmlinkage int sys_ipc (uint call, int first, int second, ...@@ -186,28 +186,28 @@ asmlinkage int sys_ipc (uint call, int first, int second,
/* /*
* Old cruft * Old cruft
*/ */
asmlinkage int sys_uname(struct old_utsname __user * name) asmlinkage int sys_uname(struct old_utsname __user *name)
{ {
int err; int err;
if (!name) if (!name)
return -EFAULT; return -EFAULT;
down_read(&uts_sem); down_read(&uts_sem);
err = copy_to_user(name, utsname(), sizeof (*name)); err = copy_to_user(name, utsname(), sizeof(*name));
up_read(&uts_sem); up_read(&uts_sem);
return err?-EFAULT:0; return err? -EFAULT:0;
} }
asmlinkage int sys_olduname(struct oldold_utsname __user * name) asmlinkage int sys_olduname(struct oldold_utsname __user *name)
{ {
int error; int error;
if (!name) if (!name)
return -EFAULT; return -EFAULT;
if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
return -EFAULT; return -EFAULT;
down_read(&uts_sem); down_read(&uts_sem);
error = __copy_to_user(&name->sysname, &utsname()->sysname, error = __copy_to_user(&name->sysname, &utsname()->sysname,
__OLD_UTS_LEN); __OLD_UTS_LEN);
error |= __put_user(0, name->sysname + __OLD_UTS_LEN); error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
...@@ -223,9 +223,9 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name) ...@@ -223,9 +223,9 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
error |= __copy_to_user(&name->machine, &utsname()->machine, error |= __copy_to_user(&name->machine, &utsname()->machine,
__OLD_UTS_LEN); __OLD_UTS_LEN);
error |= __put_user(0, name->machine + __OLD_UTS_LEN); error |= __put_user(0, name->machine + __OLD_UTS_LEN);
up_read(&uts_sem); up_read(&uts_sem);
error = error ? -EFAULT : 0; error = error ? -EFAULT : 0;
return error; return error;
...@@ -241,6 +241,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]) ...@@ -241,6 +241,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
long __res; long __res;
asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
: "=a" (__res) : "=a" (__res)
: "0" (__NR_execve),"ri" (filename),"c" (argv), "d" (envp) : "memory"); : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
return __res; return __res;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment