Commit ddb15ec1 authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen

[PATCH] Fix most sparse warnings in sys_ia32.c

Mostly by adding casts.

I didn't touch the "invalid access past ..." which are caused
by the sigset conversion.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent dd2994f6
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/fsnotify.h> #include <linux/fsnotify.h>
#include <linux/sysctl.h>
#include <asm/mman.h> #include <asm/mman.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -389,7 +390,9 @@ sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, ...@@ -389,7 +390,9 @@ sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
} }
} }
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, ret = sys_rt_sigprocmask(how,
set ? (sigset_t __user *)&s : NULL,
oset ? (sigset_t __user *)&s : NULL,
sigsetsize); sigsetsize);
set_fs (old_fs); set_fs (old_fs);
if (ret) return ret; if (ret) return ret;
...@@ -541,7 +544,7 @@ sys32_sysinfo(struct sysinfo32 __user *info) ...@@ -541,7 +544,7 @@ sys32_sysinfo(struct sysinfo32 __user *info)
int bitcount = 0; int bitcount = 0;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sysinfo(&s); ret = sys_sysinfo((struct sysinfo __user *)&s);
set_fs (old_fs); set_fs (old_fs);
/* Check to see if any memory value is too large for 32-bit and scale /* Check to see if any memory value is too large for 32-bit and scale
...@@ -589,7 +592,7 @@ sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *int ...@@ -589,7 +592,7 @@ sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *int
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t); ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
set_fs (old_fs); set_fs (old_fs);
if (put_compat_timespec(&t, interval)) if (put_compat_timespec(&t, interval))
return -EFAULT; return -EFAULT;
...@@ -605,7 +608,7 @@ sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) ...@@ -605,7 +608,7 @@ sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_rt_sigpending(&s, sigsetsize); ret = sys_rt_sigpending((sigset_t __user *)&s, sigsetsize);
set_fs (old_fs); set_fs (old_fs);
if (!ret) { if (!ret) {
switch (_NSIG_WORDS) { switch (_NSIG_WORDS) {
...@@ -630,7 +633,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) ...@@ -630,7 +633,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
if (copy_siginfo_from_user32(&info, uinfo)) if (copy_siginfo_from_user32(&info, uinfo))
return -EFAULT; return -EFAULT;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_rt_sigqueueinfo(pid, sig, &info); ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
set_fs (old_fs); set_fs (old_fs);
return ret; return ret;
} }
...@@ -666,9 +669,6 @@ sys32_sysctl(struct sysctl_ia32 __user *args32) ...@@ -666,9 +669,6 @@ sys32_sysctl(struct sysctl_ia32 __user *args32)
size_t oldlen; size_t oldlen;
int __user *namep; int __user *namep;
long ret; long ret;
extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
void *newval, size_t newlen);
if (copy_from_user(&a32, args32, sizeof (a32))) if (copy_from_user(&a32, args32, sizeof (a32)))
return -EFAULT; return -EFAULT;
...@@ -692,7 +692,8 @@ sys32_sysctl(struct sysctl_ia32 __user *args32) ...@@ -692,7 +692,8 @@ sys32_sysctl(struct sysctl_ia32 __user *args32)
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
lock_kernel(); lock_kernel();
ret = do_sysctl(namep, a32.nlen, oldvalp, &oldlen, newvalp, (size_t) a32.newlen); ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen,
newvalp, (size_t) a32.newlen);
unlock_kernel(); unlock_kernel();
set_fs(old_fs); set_fs(old_fs);
...@@ -743,7 +744,8 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) ...@@ -743,7 +744,8 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
return -EFAULT; return -EFAULT;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
count);
set_fs(old_fs); set_fs(old_fs);
if (offset && put_user(of, offset)) if (offset && put_user(of, offset))
...@@ -831,7 +833,7 @@ long sys32_ustat(unsigned dev, struct ustat32 __user *u32p) ...@@ -831,7 +833,7 @@ long sys32_ustat(unsigned dev, struct ustat32 __user *u32p)
seg = get_fs(); seg = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ustat(dev,&u); ret = sys_ustat(dev, (struct ustat __user *)&u);
set_fs(seg); set_fs(seg);
if (ret >= 0) { if (ret >= 0) {
if (!access_ok(VERIFY_WRITE,u32p,sizeof(struct ustat32)) || if (!access_ok(VERIFY_WRITE,u32p,sizeof(struct ustat32)) ||
......
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