* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
-asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
+asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t)
{
struct timeval tv[2];
return do_utimes(filename, t ? tv : NULL);
}
-asmlinkage long compat_sys_utimes(char *filename, struct compat_timeval *t)
+asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t)
{
struct timeval tv[2];
return do_utimes(filename, t ? tv : NULL);
}
-asmlinkage long compat_sys_newstat(char * filename,
- struct compat_stat *statbuf)
+asmlinkage long compat_sys_newstat(char __user * filename,
+ struct compat_stat __user *statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
return error;
}
-asmlinkage long compat_sys_newlstat(char * filename,
- struct compat_stat *statbuf)
+asmlinkage long compat_sys_newlstat(char __user * filename,
+ struct compat_stat __user *statbuf)
{
struct kstat stat;
int error = vfs_lstat(filename, &stat);
}
asmlinkage long compat_sys_newfstat(unsigned int fd,
- struct compat_stat * statbuf)
+ struct compat_stat __user * statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
return error;
}
-static int put_compat_statfs(struct compat_statfs *ubuf, struct kstatfs *kbuf)
+static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *kbuf)
{
if (sizeof ubuf->f_blocks == 4) {
* The following statfs calls are copies of code from fs/open.c and
* should be checked against those from time to time
*/
-asmlinkage long compat_sys_statfs(const char *path, struct compat_statfs *buf)
+asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf)
{
struct nameidata nd;
int error;
return error;
}
-asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf)
+asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf)
{
struct file * file;
struct kstatfs tmp;
return error;
}
-static int put_compat_statfs64(struct compat_statfs64 *ubuf, struct kstatfs *kbuf)
+static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf)
{
if (sizeof ubuf->f_blocks == 4) {
if ((kbuf->f_blocks | kbuf->f_bfree |
return 0;
}
-asmlinkage long compat_statfs64(const char *path, compat_size_t sz, struct compat_statfs64 *buf)
+asmlinkage long compat_statfs64(const char __user *path, compat_size_t sz, struct compat_statfs64 __user *buf)
{
struct nameidata nd;
int error;
return error;
}
-asmlinkage long compat_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 *buf)
+asmlinkage long compat_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf)
{
struct file * file;
struct kstatfs tmp;
return error;
}
-static int get_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
{
if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) ||
__get_user(kfl->l_type, &ufl->l_type) ||
return 0;
}
-static int put_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
{
if (!access_ok(VERIFY_WRITE, ufl, sizeof(*ufl)) ||
__put_user(kfl->l_type, &ufl->l_type) ||
}
#ifndef HAVE_ARCH_GET_COMPAT_FLOCK64
-static int get_compat_flock64(struct flock *kfl, struct compat_flock64 *ufl)
+static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
{
if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) ||
__get_user(kfl->l_type, &ufl->l_type) ||
#endif
#ifndef HAVE_ARCH_PUT_COMPAT_FLOCK64
-static int put_compat_flock64(struct flock *kfl, struct compat_flock64 *ufl)
+static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
{
if (!access_ok(VERIFY_WRITE, ufl, sizeof(*ufl)) ||
__put_user(kfl->l_type, &ufl->l_type) ||
}
asmlinkage long
-compat_sys_io_setup(unsigned nr_reqs, u32 *ctx32p)
+compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
{
long ret;
aio_context_t ctx64;
return -EFAULT;
set_fs(KERNEL_DS);
- ret = sys_io_setup(nr_reqs, &ctx64);
+ /* The __user pointer cast is valid because of the set_fs() */
+ ret = sys_io_setup(nr_reqs, (aio_context_t __user *) &ctx64);
set_fs(oldfs);
/* truncating is ok because it's a user address */
if (!ret)
compat_sys_io_getevents(aio_context_t ctx_id,
unsigned long min_nr,
unsigned long nr,
- struct io_event *events,
- struct compat_timespec *timeout)
+ struct io_event __user *events,
+ struct compat_timespec __user *timeout)
{
long ret;
struct timespec t;
- struct timespec *ut = NULL;
+ struct timespec __user *ut = NULL;
ret = -EFAULT;
if (unlikely(!access_ok(VERIFY_WRITE, events,
}
static inline long
-copy_iocb(long nr, u32 *ptr32, u64 *ptr64)
+copy_iocb(long nr, u32 __user *ptr32, u64 __user *ptr64)
{
compat_uptr_t uptr;
int i;
#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *))
asmlinkage long
-compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 *iocb)
+compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb)
{
- struct iocb **iocb64;
+ struct iocb __user * __user *iocb64;
long ret;
if (unlikely(nr < 0))
nr = MAX_AIO_SUBMITS;
iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
- ret = copy_iocb(nr, iocb, (u64 *) iocb64);
+ ret = copy_iocb(nr, iocb, (u64 __user *) iocb64);
if (!ret)
ret = sys_io_submit(ctx_id, nr, iocb64);
return ret;
* a copy of count() from fs/exec.c, except that it works with 32 bit argv
* and envp pointers.
*/
-static int compat_count(compat_uptr_t *argv, int max)
+static int compat_count(compat_uptr_t __user *argv, int max)
{
int i = 0;
struct knfsd_fh cr32_getfs;
};
-static int compat_nfs_svc_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg *arg)
+static int compat_nfs_svc_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
{
int err;
return (err) ? -EFAULT : 0;
}
-static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg *arg)
+static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
{
int err;
return (err) ? -EFAULT : 0;
}
-static int compat_nfs_exp_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg *arg)
+static int compat_nfs_exp_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
{
int err;
return (err) ? -EFAULT : 0;
}
-static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg *arg)
+static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
{
int err;
return (err) ? -EFAULT : 0;
}
-static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg *arg)
+static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
{
int err;
/* This really doesn't need translations, we are only passing
* back a union which contains opaque nfs file handle data.
*/
-static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsctl_res *res)
+static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsctl_res __user *res)
{
int err;
return (err) ? -EFAULT : 0;
}
-asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg *arg,
- union compat_nfsctl_res *res)
+asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user *arg,
+ union compat_nfsctl_res __user *res)
{
struct nfsctl_arg *karg;
union nfsctl_res *kres;
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_nfsservctl(cmd, karg, kres);
+ /* The __user pointer casts are valid because of the set_fs() */
+ err = sys_nfsservctl(cmd, (void __user *) karg, (void __user *) kres);
set_fs(oldfs);
if (err)