Commit 52e86726 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] solaris emulation annotated

trivial annotations and cleanups + proper use of vfs_...stat().
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent def699d3
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
__asm__ ("srl %0, 0, %0" \ __asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \ : "=r" (__ret) \
: "0" (__x)); \ : "0" (__x)); \
__ret; \ (void __user *)__ret; \
}) })
extern unsigned sys_call_table[]; extern unsigned sys_call_table[];
......
...@@ -79,7 +79,7 @@ struct sol_stat64 { ...@@ -79,7 +79,7 @@ struct sol_stat64 {
#define UFSMAGIC (((unsigned)'u'<<24)||((unsigned)'f'<<16)||((unsigned)'s'<<8)) #define UFSMAGIC (((unsigned)'u'<<24)||((unsigned)'f'<<16)||((unsigned)'s'<<8))
static inline int putstat(struct sol_stat *ubuf, struct kstat *kbuf) static inline int putstat(struct sol_stat __user *ubuf, struct kstat *kbuf)
{ {
if (kbuf->size > MAX_NON_LFS || if (kbuf->size > MAX_NON_LFS ||
!sysv_valid_dev(kbuf->dev) || !sysv_valid_dev(kbuf->dev) ||
...@@ -101,12 +101,12 @@ static inline int putstat(struct sol_stat *ubuf, struct kstat *kbuf) ...@@ -101,12 +101,12 @@ static inline int putstat(struct sol_stat *ubuf, struct kstat *kbuf)
__put_user (kbuf->ctime.tv_nsec, &ubuf->st_ctime.tv_nsec) || __put_user (kbuf->ctime.tv_nsec, &ubuf->st_ctime.tv_nsec) ||
__put_user (kbuf->blksize, &ubuf->st_blksize) || __put_user (kbuf->blksize, &ubuf->st_blksize) ||
__put_user (kbuf->blocks, &ubuf->st_blocks) || __put_user (kbuf->blocks, &ubuf->st_blocks) ||
__put_user (UFSMAGIC, (unsigned *)ubuf->st_fstype)) __put_user (UFSMAGIC, (unsigned __user *)ubuf->st_fstype))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static inline int putstat64(struct sol_stat64 *ubuf, struct kstat *kbuf) static inline int putstat64(struct sol_stat64 __user *ubuf, struct kstat *kbuf)
{ {
if (!sysv_valid_dev(kbuf->dev) || !sysv_valid_dev(kbuf->rdev)) if (!sysv_valid_dev(kbuf->dev) || !sysv_valid_dev(kbuf->rdev))
return -EOVERFLOW; return -EOVERFLOW;
...@@ -126,27 +126,17 @@ static inline int putstat64(struct sol_stat64 *ubuf, struct kstat *kbuf) ...@@ -126,27 +126,17 @@ static inline int putstat64(struct sol_stat64 *ubuf, struct kstat *kbuf)
__put_user (kbuf->ctime.tv_nsec, &ubuf->st_ctime.tv_nsec) || __put_user (kbuf->ctime.tv_nsec, &ubuf->st_ctime.tv_nsec) ||
__put_user (kbuf->blksize, &ubuf->st_blksize) || __put_user (kbuf->blksize, &ubuf->st_blksize) ||
__put_user (kbuf->blocks, &ubuf->st_blocks) || __put_user (kbuf->blocks, &ubuf->st_blocks) ||
__put_user (UFSMAGIC, (unsigned *)ubuf->st_fstype)) __put_user (UFSMAGIC, (unsigned __user *)ubuf->st_fstype))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
asmlinkage int solaris_stat(u32 filename, u32 statbuf) asmlinkage int solaris_stat(u32 filename, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
char *filenam; int ret = vfs_stat(A(filename), &s);
mm_segment_t old_fs = get_fs(); if (!ret)
return putstat(A(statbuf), &s);
filenam = getname ((char *)A(filename));
ret = PTR_ERR(filenam);
if (!IS_ERR(filenam)) {
set_fs (KERNEL_DS);
ret = vfs_stat(filenam, &s);
set_fs (old_fs);
putname (filenam);
return putstat((struct sol_stat *)A(statbuf), &s);
}
return ret; return ret;
} }
...@@ -158,39 +148,19 @@ asmlinkage int solaris_xstat(int vers, u32 filename, u32 statbuf) ...@@ -158,39 +148,19 @@ asmlinkage int solaris_xstat(int vers, u32 filename, u32 statbuf)
asmlinkage int solaris_stat64(u32 filename, u32 statbuf) asmlinkage int solaris_stat64(u32 filename, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
char *filenam; int ret = vfs_stat(A(filename), &s);
mm_segment_t old_fs = get_fs(); if (!ret)
return putstat64(A(statbuf), &s);
filenam = getname ((char *)A(filename));
ret = PTR_ERR(filenam);
if (!IS_ERR(filenam)) {
set_fs (KERNEL_DS);
ret = vfs_stat(filenam, &s);
set_fs (old_fs);
putname (filenam);
return putstat64((struct sol_stat64 *)A(statbuf), &s);
}
return ret; return ret;
} }
asmlinkage int solaris_lstat(u32 filename, u32 statbuf) asmlinkage int solaris_lstat(u32 filename, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
char *filenam; int ret = vfs_lstat(A(filename), &s);
mm_segment_t old_fs = get_fs(); if (!ret)
return putstat(A(statbuf), &s);
filenam = getname ((char *)A(filename));
ret = PTR_ERR(filenam);
if (!IS_ERR(filenam)) {
set_fs (KERNEL_DS);
ret = vfs_lstat(filenam, &s);
set_fs (old_fs);
putname (filenam);
return putstat((struct sol_stat *)A(statbuf), &s);
}
return ret; return ret;
} }
...@@ -201,30 +171,19 @@ asmlinkage int solaris_lxstat(int vers, u32 filename, u32 statbuf) ...@@ -201,30 +171,19 @@ asmlinkage int solaris_lxstat(int vers, u32 filename, u32 statbuf)
asmlinkage int solaris_lstat64(u32 filename, u32 statbuf) asmlinkage int solaris_lstat64(u32 filename, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
char *filenam; int ret = vfs_lstat(A(filename), &s);
mm_segment_t old_fs = get_fs(); if (!ret)
return putstat64(A(statbuf), &s);
filenam = getname ((char *)A(filename));
ret = PTR_ERR(filenam);
if (!IS_ERR(filenam)) {
set_fs (KERNEL_DS);
ret = vfs_lstat(filenam, &s);
set_fs (old_fs);
putname (filenam);
return putstat64((struct sol_stat64 *)A(statbuf), &s);
}
return ret; return ret;
} }
asmlinkage int solaris_fstat(unsigned int fd, u32 statbuf) asmlinkage int solaris_fstat(unsigned int fd, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
ret = vfs_fstat(fd, &s); int ret = vfs_fstat(fd, &s);
if (!ret) if (!ret)
return putstat((struct sol_stat *)A(statbuf), &s); return putstat(A(statbuf), &s);
return ret; return ret;
} }
...@@ -235,27 +194,24 @@ asmlinkage int solaris_fxstat(int vers, u32 fd, u32 statbuf) ...@@ -235,27 +194,24 @@ asmlinkage int solaris_fxstat(int vers, u32 fd, u32 statbuf)
asmlinkage int solaris_fstat64(unsigned int fd, u32 statbuf) asmlinkage int solaris_fstat64(unsigned int fd, u32 statbuf)
{ {
int ret;
struct kstat s; struct kstat s;
int ret = vfs_fstat(fd, &s);
ret = vfs_fstat(fd, &s);
if (!ret) if (!ret)
return putstat64((struct sol_stat64 *)A(statbuf), &s); return putstat64(A(statbuf), &s);
return ret; return ret;
} }
asmlinkage int solaris_mknod(u32 path, u32 mode, s32 dev) asmlinkage int solaris_mknod(u32 path, u32 mode, s32 dev)
{ {
int (*sys_mknod)(const char *,int,unsigned) = int (*sys_mknod)(const char __user *,int,unsigned) =
(int (*)(const char *,int,unsigned))SYS(mknod); (int (*)(const char __user *,int,unsigned))SYS(mknod);
int major = sysv_major(dev); int major = sysv_major(dev);
int minor = sysv_minor(dev); int minor = sysv_minor(dev);
/* minor is guaranteed to be OK for MKDEV, major might be not */ /* minor is guaranteed to be OK for MKDEV, major might be not */
if (major > 0xfff) if (major > 0xfff)
return -EINVAL; return -EINVAL;
return sys_mknod((const char *)A(path), mode, return sys_mknod(A(path), mode, new_encode_dev(MKDEV(major,minor)));
new_encode_dev(MKDEV(major,minor)));
} }
asmlinkage int solaris_xmknod(int vers, u32 path, u32 mode, s32 dev) asmlinkage int solaris_xmknod(int vers, u32 path, u32 mode, s32 dev)
...@@ -263,10 +219,10 @@ asmlinkage int solaris_xmknod(int vers, u32 path, u32 mode, s32 dev) ...@@ -263,10 +219,10 @@ asmlinkage int solaris_xmknod(int vers, u32 path, u32 mode, s32 dev)
return solaris_mknod(path, mode, dev); return solaris_mknod(path, mode, dev);
} }
asmlinkage int solaris_getdents64(unsigned int fd, void *dirent, unsigned int count) asmlinkage int solaris_getdents64(unsigned int fd, void __user *dirent, unsigned int count)
{ {
int (*sys_getdents)(unsigned int, void *, unsigned int) = int (*sys_getdents)(unsigned int, void __user *, unsigned int) =
(int (*)(unsigned int, void *, unsigned int))SYS(getdents); (int (*)(unsigned int, void __user *, unsigned int))SYS(getdents);
return sys_getdents(fd, dirent, count); return sys_getdents(fd, dirent, count);
} }
...@@ -290,14 +246,15 @@ asmlinkage int solaris_statfs(u32 path, u32 buf, int len, int fstype) ...@@ -290,14 +246,15 @@ asmlinkage int solaris_statfs(u32 path, u32 buf, int len, int fstype)
int ret; int ret;
struct statfs s; struct statfs s;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_statfs)(const char *,struct statfs *) = int (*sys_statfs)(const char __user *,struct statfs __user *) =
(int (*)(const char *,struct statfs *))SYS(statfs); (int (*)(const char __user *,struct statfs __user *))SYS(statfs);
struct sol_statfs *ss = (struct sol_statfs *)A(buf); struct sol_statfs __user *ss = A(buf);
if (len != sizeof(struct sol_statfs)) return -EINVAL; if (len != sizeof(struct sol_statfs)) return -EINVAL;
if (!fstype) { if (!fstype) {
/* FIXME: mixing userland and kernel pointers */
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_statfs((const char *)A(path), &s); ret = sys_statfs(A(path), &s);
set_fs (old_fs); set_fs (old_fs);
if (!ret) { if (!ret) {
if (put_user (s.f_type, &ss->f_type) || if (put_user (s.f_type, &ss->f_type) ||
...@@ -332,9 +289,9 @@ asmlinkage int solaris_fstatfs(u32 fd, u32 buf, int len, int fstype) ...@@ -332,9 +289,9 @@ asmlinkage int solaris_fstatfs(u32 fd, u32 buf, int len, int fstype)
int ret; int ret;
struct statfs s; struct statfs s;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_fstatfs)(unsigned,struct statfs *) = int (*sys_fstatfs)(unsigned,struct statfs __user *) =
(int (*)(unsigned,struct statfs *))SYS(fstatfs); (int (*)(unsigned,struct statfs __user *))SYS(fstatfs);
struct sol_statfs *ss = (struct sol_statfs *)A(buf); struct sol_statfs __user *ss = A(buf);
if (len != sizeof(struct sol_statfs)) return -EINVAL; if (len != sizeof(struct sol_statfs)) return -EINVAL;
if (!fstype) { if (!fstype) {
...@@ -396,7 +353,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -396,7 +353,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
{ {
struct kstatfs s; struct kstatfs s;
int error; int error;
struct sol_statvfs *ss = (struct sol_statvfs *)A(buf); struct sol_statvfs __user *ss = A(buf);
error = vfs_statfs(mnt->mnt_sb, &s); error = vfs_statfs(mnt->mnt_sb, &s);
if (!error) { if (!error) {
...@@ -419,7 +376,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -419,7 +376,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
__put_user (s.f_ffree, &ss->f_favail) || __put_user (s.f_ffree, &ss->f_favail) ||
__put_user (sysv_encode_dev(inode->i_sb->s_dev), &ss->f_fsid) || __put_user (sysv_encode_dev(inode->i_sb->s_dev), &ss->f_fsid) ||
__copy_to_user (ss->f_basetype,p,j) || __copy_to_user (ss->f_basetype,p,j) ||
__put_user (0, (char *)&ss->f_basetype[j]) || __put_user (0, (char __user *)&ss->f_basetype[j]) ||
__put_user (s.f_namelen, &ss->f_namemax) || __put_user (s.f_namelen, &ss->f_namemax) ||
__put_user (i, &ss->f_flag) || __put_user (i, &ss->f_flag) ||
__clear_user (&ss->f_fstr, 32)) __clear_user (&ss->f_fstr, 32))
...@@ -432,7 +389,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -432,7 +389,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
{ {
struct kstatfs s; struct kstatfs s;
int error; int error;
struct sol_statvfs64 *ss = (struct sol_statvfs64 *)A(buf); struct sol_statvfs64 __user *ss = A(buf);
error = vfs_statfs(mnt->mnt_sb, &s); error = vfs_statfs(mnt->mnt_sb, &s);
if (!error) { if (!error) {
...@@ -455,7 +412,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -455,7 +412,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
__put_user (s.f_ffree, &ss->f_favail) || __put_user (s.f_ffree, &ss->f_favail) ||
__put_user (sysv_encode_dev(inode->i_sb->s_dev), &ss->f_fsid) || __put_user (sysv_encode_dev(inode->i_sb->s_dev), &ss->f_fsid) ||
__copy_to_user (ss->f_basetype,p,j) || __copy_to_user (ss->f_basetype,p,j) ||
__put_user (0, (char *)&ss->f_basetype[j]) || __put_user (0, (char __user *)&ss->f_basetype[j]) ||
__put_user (s.f_namelen, &ss->f_namemax) || __put_user (s.f_namelen, &ss->f_namemax) ||
__put_user (i, &ss->f_flag) || __put_user (i, &ss->f_flag) ||
__clear_user (&ss->f_fstr, 32)) __clear_user (&ss->f_fstr, 32))
...@@ -469,7 +426,7 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf) ...@@ -469,7 +426,7 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
struct nameidata nd; struct nameidata nd;
int error; int error;
error = user_path_walk((const char *)A(path),&nd); error = user_path_walk(A(path),&nd);
if (!error) { if (!error) {
struct inode * inode = nd.dentry->d_inode; struct inode * inode = nd.dentry->d_inode;
error = report_statvfs(nd.mnt, inode, buf); error = report_statvfs(nd.mnt, inode, buf);
...@@ -499,7 +456,7 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf) ...@@ -499,7 +456,7 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
int error; int error;
lock_kernel(); lock_kernel();
error = user_path_walk((const char *)A(path), &nd); error = user_path_walk(A(path), &nd);
if (!error) { if (!error) {
struct inode * inode = nd.dentry->d_inode; struct inode * inode = nd.dentry->d_inode;
error = report_statvfs64(nd.mnt, inode, buf); error = report_statvfs64(nd.mnt, inode, buf);
...@@ -594,6 +551,7 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg) ...@@ -594,6 +551,7 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg)
case SOL_F_SETLKW: case SOL_F_SETLKW:
{ {
struct flock f; struct flock f;
struct sol_flock __user *p = A(arg);
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
switch (cmd) { switch (cmd) {
...@@ -602,23 +560,23 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg) ...@@ -602,23 +560,23 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg)
case SOL_F_SETLKW: cmd = F_SETLKW; break; case SOL_F_SETLKW: cmd = F_SETLKW; break;
} }
if (get_user (f.l_type, &((struct sol_flock *)A(arg))->l_type) || if (get_user (f.l_type, &p->l_type) ||
__get_user (f.l_whence, &((struct sol_flock *)A(arg))->l_whence) || __get_user (f.l_whence, &p->l_whence) ||
__get_user (f.l_start, &((struct sol_flock *)A(arg))->l_start) || __get_user (f.l_start, &p->l_start) ||
__get_user (f.l_len, &((struct sol_flock *)A(arg))->l_len) || __get_user (f.l_len, &p->l_len) ||
__get_user (f.l_pid, &((struct sol_flock *)A(arg))->l_sysid)) __get_user (f.l_pid, &p->l_sysid))
return -EFAULT; return -EFAULT;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_fcntl(fd, cmd, (unsigned long)&f); ret = sys_fcntl(fd, cmd, (unsigned long)&f);
set_fs(old_fs); set_fs(old_fs);
if (__put_user (f.l_type, &((struct sol_flock *)A(arg))->l_type) || if (__put_user (f.l_type, &p->l_type) ||
__put_user (f.l_whence, &((struct sol_flock *)A(arg))->l_whence) || __put_user (f.l_whence, &p->l_whence) ||
__put_user (f.l_start, &((struct sol_flock *)A(arg))->l_start) || __put_user (f.l_start, &p->l_start) ||
__put_user (f.l_len, &((struct sol_flock *)A(arg))->l_len) || __put_user (f.l_len, &p->l_len) ||
__put_user (f.l_pid, &((struct sol_flock *)A(arg))->l_pid) || __put_user (f.l_pid, &p->l_pid) ||
__put_user (0, &((struct sol_flock *)A(arg))->l_sysid)) __put_user (0, &p->l_sysid))
return -EFAULT; return -EFAULT;
return ret; return ret;
...@@ -629,7 +587,7 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg) ...@@ -629,7 +587,7 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg)
int (*sys_newftruncate)(unsigned int, unsigned long)= int (*sys_newftruncate)(unsigned int, unsigned long)=
(int (*)(unsigned int, unsigned long))SYS(ftruncate); (int (*)(unsigned int, unsigned long))SYS(ftruncate);
if (get_user(length, &((struct sol_flock*)A(arg))->l_start)) if (get_user(length, &((struct sol_flock __user *)A(arg))->l_start))
return -EFAULT; return -EFAULT;
return sys_newftruncate(fd, length); return sys_newftruncate(fd, length);
...@@ -677,18 +635,18 @@ asmlinkage int solaris_facl(unsigned int fd, int cmd, int nentries, u32 aclbufp) ...@@ -677,18 +635,18 @@ asmlinkage int solaris_facl(unsigned int fd, int cmd, int nentries, u32 aclbufp)
return -ENOSYS; return -ENOSYS;
} }
asmlinkage int solaris_pread(unsigned int fd, char *buf, u32 count, u32 pos) asmlinkage int solaris_pread(unsigned int fd, char __user *buf, u32 count, u32 pos)
{ {
ssize_t (*sys_pread64)(unsigned int, char *, size_t, loff_t) = ssize_t (*sys_pread64)(unsigned int, char __user *, size_t, loff_t) =
(ssize_t (*)(unsigned int, char *, size_t, loff_t))SYS(pread64); (ssize_t (*)(unsigned int, char __user *, size_t, loff_t))SYS(pread64);
return sys_pread64(fd, buf, count, (loff_t)pos); return sys_pread64(fd, buf, count, (loff_t)pos);
} }
asmlinkage int solaris_pwrite(unsigned int fd, char *buf, u32 count, u32 pos) asmlinkage int solaris_pwrite(unsigned int fd, char __user *buf, u32 count, u32 pos)
{ {
ssize_t (*sys_pwrite64)(unsigned int, char *, size_t, loff_t) = ssize_t (*sys_pwrite64)(unsigned int, char __user *, size_t, loff_t) =
(ssize_t (*)(unsigned int, char *, size_t, loff_t))SYS(pwrite64); (ssize_t (*)(unsigned int, char __user *, size_t, loff_t))SYS(pwrite64);
return sys_pwrite64(fd, buf, count, (loff_t)pos); return sys_pwrite64(fd, buf, count, (loff_t)pos);
} }
...@@ -757,8 +715,8 @@ asmlinkage int solaris_pathconf(u32 path, int name) ...@@ -757,8 +715,8 @@ asmlinkage int solaris_pathconf(u32 path, int name)
/* solaris_llseek returns long long - quite difficult */ /* solaris_llseek returns long long - quite difficult */
asmlinkage long solaris_llseek(struct pt_regs *regs, u32 off_hi, u32 off_lo, int whence) asmlinkage long solaris_llseek(struct pt_regs *regs, u32 off_hi, u32 off_lo, int whence)
{ {
int (*sys_llseek)(unsigned int, unsigned long, unsigned long, loff_t *, unsigned int) = int (*sys_llseek)(unsigned int, unsigned long, unsigned long, loff_t __user *, unsigned int) =
(int (*)(unsigned int, unsigned long, unsigned long, loff_t *, unsigned int))SYS(_llseek); (int (*)(unsigned int, unsigned long, unsigned long, loff_t __user *, unsigned int))SYS(_llseek);
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
loff_t retval; loff_t retval;
...@@ -774,8 +732,8 @@ asmlinkage long solaris_llseek(struct pt_regs *regs, u32 off_hi, u32 off_lo, int ...@@ -774,8 +732,8 @@ asmlinkage long solaris_llseek(struct pt_regs *regs, u32 off_hi, u32 off_lo, int
/* Have to mask out all but lower 3 bits */ /* Have to mask out all but lower 3 bits */
asmlinkage int solaris_access(u32 filename, long mode) asmlinkage int solaris_access(u32 filename, long mode)
{ {
int (*sys_access)(const char *, int) = int (*sys_access)(const char __user *, int) =
(int (*)(const char *, int))SYS(access); (int (*)(const char __user *, int))SYS(access);
return sys_access((const char *)A(filename), mode & 7); return sys_access(A(filename), mode & 7);
} }
...@@ -39,10 +39,10 @@ extern asmlinkage int compat_sys_ioctl(unsigned int fd, unsigned int cmd, ...@@ -39,10 +39,10 @@ extern asmlinkage int compat_sys_ioctl(unsigned int fd, unsigned int cmd,
u32 arg); u32 arg);
asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg); asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
extern int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, extern int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len,
char *data_buf, int data_len, int flags); char __user *data_buf, int data_len, int flags);
extern int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, int *ctl_len, extern int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, int __user *ctl_len,
char *data_buf, int data_maxlen, int *data_len, int *flags); char __user *data_buf, int data_maxlen, int __user *data_len, int *flags);
/* termio* stuff {{{ */ /* termio* stuff {{{ */
...@@ -117,16 +117,17 @@ static u32 linux_to_solaris_cflag(u32 cflag) ...@@ -117,16 +117,17 @@ static u32 linux_to_solaris_cflag(u32 cflag)
static inline int linux_to_solaris_termio(unsigned int fd, unsigned int cmd, u32 arg) static inline int linux_to_solaris_termio(unsigned int fd, unsigned int cmd, u32 arg)
{ {
struct solaris_termio __user *p = A(arg);
int ret; int ret;
ret = sys_ioctl(fd, cmd, A(arg)); ret = sys_ioctl(fd, cmd, (unsigned long)p);
if (!ret) { if (!ret) {
u32 cflag; u32 cflag;
if (__get_user (cflag, &((struct solaris_termio *)A(arg))->c_cflag)) if (__get_user (cflag, &p->c_cflag))
return -EFAULT; return -EFAULT;
cflag = linux_to_solaris_cflag(cflag); cflag = linux_to_solaris_cflag(cflag);
if (__put_user (cflag, &((struct solaris_termio *)A(arg))->c_cflag)) if (__put_user (cflag, &p->c_cflag))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -138,7 +139,7 @@ static int solaris_to_linux_termio(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -138,7 +139,7 @@ static int solaris_to_linux_termio(unsigned int fd, unsigned int cmd, u32 arg)
struct solaris_termio s; struct solaris_termio s;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
if (copy_from_user (&s, (struct solaris_termio *)A(arg), sizeof(struct solaris_termio))) if (copy_from_user (&s, (struct solaris_termio __user *)A(arg), sizeof(struct solaris_termio)))
return -EFAULT; return -EFAULT;
s.c_cflag = solaris_to_linux_cflag(s.c_cflag); s.c_cflag = solaris_to_linux_cflag(s.c_cflag);
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -157,12 +158,13 @@ static inline int linux_to_solaris_termios(unsigned int fd, unsigned int cmd, u3 ...@@ -157,12 +158,13 @@ static inline int linux_to_solaris_termios(unsigned int fd, unsigned int cmd, u3
ret = sys_ioctl(fd, cmd, (unsigned long)&s); ret = sys_ioctl(fd, cmd, (unsigned long)&s);
set_fs(old_fs); set_fs(old_fs);
if (!ret) { if (!ret) {
if (put_user (s.c_iflag, &((struct solaris_termios *)A(arg))->c_iflag) || struct solaris_termios __user *p = A(arg);
__put_user (s.c_oflag, &((struct solaris_termios *)A(arg))->c_oflag) || if (put_user (s.c_iflag, &p->c_iflag) ||
__put_user (linux_to_solaris_cflag(s.c_cflag), &((struct solaris_termios *)A(arg))->c_cflag) || __put_user (s.c_oflag, &p->c_oflag) ||
__put_user (s.c_lflag, &((struct solaris_termios *)A(arg))->c_lflag) || __put_user (linux_to_solaris_cflag(s.c_cflag), &p->c_cflag) ||
__copy_to_user (((struct solaris_termios *)A(arg))->c_cc, s.c_cc, 16) || __put_user (s.c_lflag, &p->c_lflag) ||
__clear_user (((struct solaris_termios *)A(arg))->c_cc + 16, 2)) __copy_to_user (p->c_cc, s.c_cc, 16) ||
__clear_user (p->c_cc + 16, 2))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -172,17 +174,18 @@ static int solaris_to_linux_termios(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -172,17 +174,18 @@ static int solaris_to_linux_termios(unsigned int fd, unsigned int cmd, u32 arg)
{ {
int ret; int ret;
struct solaris_termios s; struct solaris_termios s;
struct solaris_termios __user *p = A(arg);
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ioctl(fd, TCGETS, (unsigned long)&s); ret = sys_ioctl(fd, TCGETS, (unsigned long)&s);
set_fs(old_fs); set_fs(old_fs);
if (ret) return ret; if (ret) return ret;
if (put_user (s.c_iflag, &((struct solaris_termios *)A(arg))->c_iflag) || if (put_user (s.c_iflag, &p->c_iflag) ||
__put_user (s.c_oflag, &((struct solaris_termios *)A(arg))->c_oflag) || __put_user (s.c_oflag, &p->c_oflag) ||
__put_user (s.c_cflag, &((struct solaris_termios *)A(arg))->c_cflag) || __put_user (s.c_cflag, &p->c_cflag) ||
__put_user (s.c_lflag, &((struct solaris_termios *)A(arg))->c_lflag) || __put_user (s.c_lflag, &p->c_lflag) ||
__copy_from_user (s.c_cc, ((struct solaris_termios *)A(arg))->c_cc, 16)) __copy_from_user (s.c_cc, p->c_cc, 16))
return -EFAULT; return -EFAULT;
s.c_cflag = solaris_to_linux_cflag(s.c_cflag); s.c_cflag = solaris_to_linux_cflag(s.c_cflag);
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -305,7 +308,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -305,7 +308,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
case 109: /* SI_SOCKPARAMS */ case 109: /* SI_SOCKPARAMS */
{ {
struct solaris_si_sockparams si; struct solaris_si_sockparams si;
if (copy_from_user (&si, (struct solaris_si_sockparams *) A(arg), sizeof(si))) if (copy_from_user (&si, A(arg), sizeof(si)))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
/* Should we modify socket ino->socket_i.ops and type? */ /* Should we modify socket ino->socket_i.ops and type? */
...@@ -314,6 +317,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -314,6 +317,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
case 110: /* SI_GETUDATA */ case 110: /* SI_GETUDATA */
{ {
int etsdusize, servtype; int etsdusize, servtype;
struct solaris_si_udata __user *p = A(arg);
switch (SOCKET_I(ino)->type) { switch (SOCKET_I(ino)->type) {
case SOCK_STREAM: case SOCK_STREAM:
etsdusize = 1; etsdusize = 1;
...@@ -324,23 +328,24 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -324,23 +328,24 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
servtype = 3; servtype = 3;
break; break;
} }
if (put_user(16384, &((struct solaris_si_udata *)A(arg))->tidusize) || if (put_user(16384, &p->tidusize) ||
__put_user(sizeof(struct sockaddr), &((struct solaris_si_udata *)A(arg))->addrsize) || __put_user(sizeof(struct sockaddr), &p->addrsize) ||
__put_user(-1, &((struct solaris_si_udata *)A(arg))->optsize) || __put_user(-1, &p->optsize) ||
__put_user(etsdusize, &((struct solaris_si_udata *)A(arg))->etsdusize) || __put_user(etsdusize, &p->etsdusize) ||
__put_user(servtype, &((struct solaris_si_udata *)A(arg))->servtype) || __put_user(servtype, &p->servtype) ||
__put_user(0, &((struct solaris_si_udata *)A(arg))->so_state) || __put_user(0, &p->so_state) ||
__put_user(0, &((struct solaris_si_udata *)A(arg))->so_options) || __put_user(0, &p->so_options) ||
__put_user(16384, &((struct solaris_si_udata *)A(arg))->tsdusize) || __put_user(16384, &p->tsdusize) ||
__put_user(SOCKET_I(ino)->ops->family, &((struct solaris_si_udata *)A(arg))->sockparams.sp_family) || __put_user(SOCKET_I(ino)->ops->family, &p->sockparams.sp_family) ||
__put_user(SOCKET_I(ino)->type, &((struct solaris_si_udata *)A(arg))->sockparams.sp_type) || __put_user(SOCKET_I(ino)->type, &p->sockparams.sp_type) ||
__put_user(SOCKET_I(ino)->ops->family, &((struct solaris_si_udata *)A(arg))->sockparams.sp_protocol)) __put_user(SOCKET_I(ino)->ops->family, &p->sockparams.sp_protocol))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
return 0; return 0;
} }
case 101: /* O_SI_GETUDATA */ case 101: /* O_SI_GETUDATA */
{ {
int etsdusize, servtype; int etsdusize, servtype;
struct solaris_o_si_udata __user *p = A(arg);
switch (SOCKET_I(ino)->type) { switch (SOCKET_I(ino)->type) {
case SOCK_STREAM: case SOCK_STREAM:
etsdusize = 1; etsdusize = 1;
...@@ -351,14 +356,14 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -351,14 +356,14 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
servtype = 3; servtype = 3;
break; break;
} }
if (put_user(16384, &((struct solaris_o_si_udata *)A(arg))->tidusize) || if (put_user(16384, &p->tidusize) ||
__put_user(sizeof(struct sockaddr), &((struct solaris_o_si_udata *)A(arg))->addrsize) || __put_user(sizeof(struct sockaddr), &p->addrsize) ||
__put_user(-1, &((struct solaris_o_si_udata *)A(arg))->optsize) || __put_user(-1, &p->optsize) ||
__put_user(etsdusize, &((struct solaris_o_si_udata *)A(arg))->etsdusize) || __put_user(etsdusize, &p->etsdusize) ||
__put_user(servtype, &((struct solaris_o_si_udata *)A(arg))->servtype) || __put_user(servtype, &p->servtype) ||
__put_user(0, &((struct solaris_o_si_udata *)A(arg))->so_state) || __put_user(0, &p->so_state) ||
__put_user(0, &((struct solaris_o_si_udata *)A(arg))->so_options) || __put_user(0, &p->so_options) ||
__put_user(16384, &((struct solaris_o_si_udata *)A(arg))->tsdusize)) __put_user(16384, &p->tsdusize))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
return 0; return 0;
} }
...@@ -375,7 +380,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -375,7 +380,7 @@ static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
} }
static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg, static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg,
int len, int *len_p) int len, int __user *len_p)
{ {
int ret; int ret;
...@@ -385,25 +390,25 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg, ...@@ -385,25 +390,25 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg,
int i; int i;
u32 prim; u32 prim;
SOLD("TI_OPMGMT entry"); SOLD("TI_OPMGMT entry");
ret = timod_putmsg(fd, (char *)A(arg), len, NULL, -1, 0); ret = timod_putmsg(fd, A(arg), len, NULL, -1, 0);
SOLD("timod_putmsg() returned"); SOLD("timod_putmsg() returned");
if (ret) if (ret)
return (-ret << 8) | TSYSERR; return (-ret << 8) | TSYSERR;
i = MSG_HIPRI; i = MSG_HIPRI;
SOLD("calling timod_getmsg()"); SOLD("calling timod_getmsg()");
ret = timod_getmsg(fd, (char *)A(arg), len, len_p, NULL, -1, NULL, &i); ret = timod_getmsg(fd, A(arg), len, len_p, NULL, -1, NULL, &i);
SOLD("timod_getmsg() returned"); SOLD("timod_getmsg() returned");
if (ret) if (ret)
return (-ret << 8) | TSYSERR; return (-ret << 8) | TSYSERR;
SOLD("ret ok"); SOLD("ret ok");
if (get_user(prim, (u32 *)A(arg))) if (get_user(prim, (u32 __user *)A(arg)))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
SOLD("got prim"); SOLD("got prim");
if (prim == T_ERROR_ACK) { if (prim == T_ERROR_ACK) {
u32 tmp, tmp2; u32 tmp, tmp2;
SOLD("prim is T_ERROR_ACK"); SOLD("prim is T_ERROR_ACK");
if (get_user(tmp, (u32 *)A(arg)+3) || if (get_user(tmp, (u32 __user *)A(arg)+3) ||
get_user(tmp2, (u32 *)A(arg)+2)) get_user(tmp2, (u32 __user *)A(arg)+2))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
return (tmp2 << 8) | tmp; return (tmp2 << 8) | tmp;
} }
...@@ -415,26 +420,26 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg, ...@@ -415,26 +420,26 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg,
int i; int i;
u32 prim; u32 prim;
SOLD("TI_BIND entry"); SOLD("TI_BIND entry");
ret = timod_putmsg(fd, (char *)A(arg), len, NULL, -1, 0); ret = timod_putmsg(fd, A(arg), len, NULL, -1, 0);
SOLD("timod_putmsg() returned"); SOLD("timod_putmsg() returned");
if (ret) if (ret)
return (-ret << 8) | TSYSERR; return (-ret << 8) | TSYSERR;
len = 1024; /* Solaris allows arbitrary return size */ len = 1024; /* Solaris allows arbitrary return size */
i = MSG_HIPRI; i = MSG_HIPRI;
SOLD("calling timod_getmsg()"); SOLD("calling timod_getmsg()");
ret = timod_getmsg(fd, (char *)A(arg), len, len_p, NULL, -1, NULL, &i); ret = timod_getmsg(fd, A(arg), len, len_p, NULL, -1, NULL, &i);
SOLD("timod_getmsg() returned"); SOLD("timod_getmsg() returned");
if (ret) if (ret)
return (-ret << 8) | TSYSERR; return (-ret << 8) | TSYSERR;
SOLD("ret ok"); SOLD("ret ok");
if (get_user(prim, (u32 *)A(arg))) if (get_user(prim, (u32 __user *)A(arg)))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
SOLD("got prim"); SOLD("got prim");
if (prim == T_ERROR_ACK) { if (prim == T_ERROR_ACK) {
u32 tmp, tmp2; u32 tmp, tmp2;
SOLD("prim is T_ERROR_ACK"); SOLD("prim is T_ERROR_ACK");
if (get_user(tmp, (u32 *)A(arg)+3) || if (get_user(tmp, (u32 __user *)A(arg)+3) ||
get_user(tmp2, (u32 *)A(arg)+2)) get_user(tmp2, (u32 __user *)A(arg)+2))
return (EFAULT << 8) | TSYSERR; return (EFAULT << 8) | TSYSERR;
return (tmp2 << 8) | tmp; return (tmp2 << 8) | tmp;
} }
...@@ -444,7 +449,7 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg, ...@@ -444,7 +449,7 @@ static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg,
SOLD("OK_ACK requested"); SOLD("OK_ACK requested");
i = MSG_HIPRI; i = MSG_HIPRI;
SOLD("calling timod_getmsg()"); SOLD("calling timod_getmsg()");
ret = timod_getmsg(fd, (char *)A(arg), len, len_p, NULL, -1, NULL, &i); ret = timod_getmsg(fd, A(arg), len, len_p, NULL, -1, NULL, &i);
SOLD("timod_getmsg() returned"); SOLD("timod_getmsg() returned");
if (ret) if (ret)
return (-ret << 8) | TSYSERR; return (-ret << 8) | TSYSERR;
...@@ -491,7 +496,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd ...@@ -491,7 +496,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd
return -ENOSYS; return -ENOSYS;
case 2: /* I_PUSH */ case 2: /* I_PUSH */
{ {
p = getname ((char *)A(arg)); p = getname (A(arg));
if (IS_ERR (p)) if (IS_ERR (p))
return PTR_ERR(p); return PTR_ERR(p);
ret = -EINVAL; ret = -EINVAL;
...@@ -520,14 +525,14 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd ...@@ -520,14 +525,14 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd
const char *p; const char *p;
if (sock->modcount <= 0) return -EINVAL; if (sock->modcount <= 0) return -EINVAL;
p = module_table[(unsigned)sock->module[sock->modcount]].name; p = module_table[(unsigned)sock->module[sock->modcount]].name;
if (copy_to_user ((char *)A(arg), p, strlen(p))) if (copy_to_user (A(arg), p, strlen(p)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
case 5: /* I_FLUSH */ case 5: /* I_FLUSH */
return 0; return 0;
case 8: /* I_STR */ case 8: /* I_STR */
if (copy_from_user(&si, (struct strioctl *)A(arg), sizeof(struct strioctl))) if (copy_from_user(&si, A(arg), sizeof(struct strioctl)))
return -EFAULT; return -EFAULT;
/* We ignore what module is actually at the top of stack. */ /* We ignore what module is actually at the top of stack. */
switch ((si.cmd >> 8) & 0xff) { switch ((si.cmd >> 8) & 0xff) {
...@@ -535,7 +540,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd ...@@ -535,7 +540,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd
return solaris_sockmod(fd, si.cmd, si.data); return solaris_sockmod(fd, si.cmd, si.data);
case 'T': case 'T':
return solaris_timod(fd, si.cmd, si.data, si.len, return solaris_timod(fd, si.cmd, si.data, si.len,
&((struct strioctl*)A(arg))->len); &((struct strioctl __user *)A(arg))->len);
default: default:
return solaris_ioctl(fd, si.cmd, si.data); return solaris_ioctl(fd, si.cmd, si.data);
} }
...@@ -551,7 +556,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd ...@@ -551,7 +556,7 @@ static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd
case 11: /* I_FIND */ case 11: /* I_FIND */
{ {
int i; int i;
p = getname ((char *)A(arg)); p = getname (A(arg));
if (IS_ERR (p)) if (IS_ERR (p))
return PTR_ERR(p); return PTR_ERR(p);
ret = 0; ret = 0;
...@@ -580,7 +585,7 @@ static inline int solaris_s(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -580,7 +585,7 @@ static inline int solaris_s(unsigned int fd, unsigned int cmd, u32 arg)
return 0; /* We don't support them */ return 0; /* We don't support them */
case 1: /* SIOCGHIWAT */ case 1: /* SIOCGHIWAT */
case 3: /* SIOCGLOWAT */ case 3: /* SIOCGLOWAT */
if (put_user (0, (u32 *)A(arg))) if (put_user (0, (u32 __user *)A(arg)))
return -EFAULT; return -EFAULT;
return 0; /* Lie */ return 0; /* Lie */
case 7: /* SIOCATMARK */ case 7: /* SIOCATMARK */
...@@ -663,7 +668,7 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -663,7 +668,7 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg)
args); args);
set_fs(old_fs); set_fs(old_fs);
if (ret >= 0) { if (ret >= 0) {
if (copy_to_user((char *)A(arg), &uaddr, uaddr_len)) if (copy_to_user(A(arg), &uaddr, uaddr_len))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -681,7 +686,7 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg) ...@@ -681,7 +686,7 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg)
for (d = dev_base; d; d = d->next) i++; for (d = dev_base; d; d = d->next) i++;
read_unlock_bh(&dev_base_lock); read_unlock_bh(&dev_base_lock);
if (put_user (i, (int *)A(arg))) if (put_user (i, (int __user *)A(arg)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
...@@ -54,8 +54,8 @@ struct solaris_shmid_ds { ...@@ -54,8 +54,8 @@ struct solaris_shmid_ds {
asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
{ {
int (*sys_ipc)(unsigned,int,int,unsigned long,void *,long) = int (*sys_ipc)(unsigned,int,int,unsigned long,void __user *,long) =
(int (*)(unsigned,int,int,unsigned long,void *,long))SYS(ipc); (int (*)(unsigned,int,int,unsigned long,void __user *,long))SYS(ipc);
mm_segment_t old_fs; mm_segment_t old_fs;
unsigned long raddr; unsigned long raddr;
int ret; int ret;
...@@ -64,7 +64,7 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -64,7 +64,7 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 0: /* shmat */ case 0: /* shmat */
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ipc(SHMAT, arg1, arg3 & ~0x4000, (unsigned long)&raddr, (void *)A(arg2), 0); ret = sys_ipc(SHMAT, arg1, arg3 & ~0x4000, (unsigned long)&raddr, A(arg2), 0);
set_fs(old_fs); set_fs(old_fs);
if (ret >= 0) return (u32)raddr; if (ret >= 0) return (u32)raddr;
else return ret; else return ret;
...@@ -78,10 +78,11 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -78,10 +78,11 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 11: /* IPC_SET */ case 11: /* IPC_SET */
{ {
struct shmid_ds s; struct shmid_ds s;
struct solaris_shmid_ds __user *p = A(arg3);
if (get_user (s.shm_perm.uid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.uid)) || if (get_user (s.shm_perm.uid, &p->shm_perm.uid) ||
__get_user (s.shm_perm.gid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.gid)) || __get_user (s.shm_perm.gid, &p->shm_perm.gid) ||
__get_user (s.shm_perm.mode, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.mode))) __get_user (s.shm_perm.mode, &p->shm_perm.mode))
return -EFAULT; return -EFAULT;
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -92,32 +93,33 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) ...@@ -92,32 +93,33 @@ asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3)
case 12: /* IPC_STAT */ case 12: /* IPC_STAT */
{ {
struct shmid_ds s; struct shmid_ds s;
struct solaris_shmid_ds __user *p = A(arg3);
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0); ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0);
set_fs(old_fs); set_fs(old_fs);
if (get_user (s.shm_perm.uid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.uid)) || if (put_user (s.shm_perm.uid, &(p->shm_perm.uid)) ||
__get_user (s.shm_perm.gid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.gid)) || __put_user (s.shm_perm.gid, &(p->shm_perm.gid)) ||
__get_user (s.shm_perm.cuid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.cuid)) || __put_user (s.shm_perm.cuid, &(p->shm_perm.cuid)) ||
__get_user (s.shm_perm.cgid, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.cgid)) || __put_user (s.shm_perm.cgid, &(p->shm_perm.cgid)) ||
__get_user (s.shm_perm.mode, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.mode)) || __put_user (s.shm_perm.mode, &(p->shm_perm.mode)) ||
__get_user (s.shm_perm.seq, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.seq)) || __put_user (s.shm_perm.seq, &(p->shm_perm.seq)) ||
__get_user (s.shm_perm.key, &(((struct solaris_shmid_ds *)A(arg3))->shm_perm.key)) || __put_user (s.shm_perm.key, &(p->shm_perm.key)) ||
__get_user (s.shm_segsz, &(((struct solaris_shmid_ds *)A(arg3))->shm_segsz)) || __put_user (s.shm_segsz, &(p->shm_segsz)) ||
__get_user (s.shm_lpid, &(((struct solaris_shmid_ds *)A(arg3))->shm_lpid)) || __put_user (s.shm_lpid, &(p->shm_lpid)) ||
__get_user (s.shm_cpid, &(((struct solaris_shmid_ds *)A(arg3))->shm_cpid)) || __put_user (s.shm_cpid, &(p->shm_cpid)) ||
__get_user (s.shm_nattch, &(((struct solaris_shmid_ds *)A(arg3))->shm_nattch)) || __put_user (s.shm_nattch, &(p->shm_nattch)) ||
__get_user (s.shm_atime, &(((struct solaris_shmid_ds *)A(arg3))->shm_atime)) || __put_user (s.shm_atime, &(p->shm_atime)) ||
__get_user (s.shm_dtime, &(((struct solaris_shmid_ds *)A(arg3))->shm_dtime)) || __put_user (s.shm_dtime, &(p->shm_dtime)) ||
__get_user (s.shm_ctime, &(((struct solaris_shmid_ds *)A(arg3))->shm_ctime))) __put_user (s.shm_ctime, &(p->shm_ctime)))
return -EFAULT; return -EFAULT;
return ret; return ret;
} }
default: return -EINVAL; default: return -EINVAL;
} }
case 2: /* shmdt */ case 2: /* shmdt */
return sys_ipc(SHMDT, 0, 0, 0, (void *)A(arg1), 0); return sys_ipc(SHMDT, 0, 0, 0, A(arg1), 0);
case 3: /* shmget */ case 3: /* shmget */
return sys_ipc(SHMGET, arg1, arg2, arg3, NULL, 0); return sys_ipc(SHMGET, arg1, arg2, arg3, NULL, 0);
} }
......
...@@ -121,10 +121,10 @@ asmlinkage u32 solaris_mmap64(struct pt_regs *regs, u32 len, u32 prot, u32 flags ...@@ -121,10 +121,10 @@ asmlinkage u32 solaris_mmap64(struct pt_regs *regs, u32 len, u32 prot, u32 flags
u32 offlo; u32 offlo;
if (regs->u_regs[UREG_G1]) { if (regs->u_regs[UREG_G1]) {
if (get_user (offlo, (u32 *)(long)((u32)regs->u_regs[UREG_I6] + 0x5c))) if (get_user (offlo, (u32 __user *)(long)((u32)regs->u_regs[UREG_I6] + 0x5c)))
return -EFAULT; return -EFAULT;
} else { } else {
if (get_user (offlo, (u32 *)(long)((u32)regs->u_regs[UREG_I6] + 0x60))) if (get_user (offlo, (u32 __user *)(long)((u32)regs->u_regs[UREG_I6] + 0x60)))
return -EFAULT; return -EFAULT;
} }
return do_solaris_mmap((u32)regs->u_regs[UREG_I0], len, prot, flags, fd, (((u64)offhi)<<32)|offlo); return do_solaris_mmap((u32)regs->u_regs[UREG_I0], len, prot, flags, fd, (((u64)offhi)<<32)|offlo);
...@@ -148,7 +148,7 @@ asmlinkage int solaris_brk(u32 brk) ...@@ -148,7 +148,7 @@ asmlinkage int solaris_brk(u32 brk)
for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \ for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \
else \ else \
i = len - 1; \ i = len - 1; \
if (__put_user('\0', (char *)(to+i))) \ if (__put_user('\0', (char __user *)((to)+i))) \
return -EFAULT; \ return -EFAULT; \
} }
...@@ -218,21 +218,17 @@ static char *serial(char *buffer) ...@@ -218,21 +218,17 @@ static char *serial(char *buffer)
asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2) asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
{ {
struct sol_uname __user *v = A(buf);
switch (which) { switch (which) {
case 0: /* old uname */ case 0: /* old uname */
/* Let's cheat */ /* Let's cheat */
set_utsfield(((struct sol_uname *)A(buf))->sysname, set_utsfield(v->sysname, "SunOS", 1, 0);
"SunOS", 1, 0);
down_read(&uts_sem); down_read(&uts_sem);
set_utsfield(((struct sol_uname *)A(buf))->nodename, set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
system_utsname.nodename, 1, 1);
up_read(&uts_sem); up_read(&uts_sem);
set_utsfield(((struct sol_uname *)A(buf))->release, set_utsfield(v->release, "2.6", 0, 0);
"2.6", 0, 0); set_utsfield(v->version, "Generic", 0, 0);
set_utsfield(((struct sol_uname *)A(buf))->version, set_utsfield(v->machine, machine(), 0, 0);
"Generic", 0, 0);
set_utsfield(((struct sol_uname *)A(buf))->machine,
machine(), 0, 0);
return 0; return 0;
case 2: /* ustat */ case 2: /* ustat */
return -ENOSYS; return -ENOSYS;
...@@ -245,18 +241,14 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2) ...@@ -245,18 +241,14 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
asmlinkage int solaris_utsname(u32 buf) asmlinkage int solaris_utsname(u32 buf)
{ {
struct sol_utsname __user *v = A(buf);
/* Why should we not lie a bit? */ /* Why should we not lie a bit? */
down_read(&uts_sem); down_read(&uts_sem);
set_utsfield(((struct sol_utsname *)A(buf))->sysname, set_utsfield(v->sysname, "SunOS", 0, 0);
"SunOS", 0, 0); set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
set_utsfield(((struct sol_utsname *)A(buf))->nodename, set_utsfield(v->release, "5.6", 0, 0);
system_utsname.nodename, 1, 1); set_utsfield(v->version, "Generic", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->release, set_utsfield(v->machine, machine(), 0, 0);
"5.6", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->version,
"Generic", 0, 0);
set_utsfield(((struct sol_utsname *)A(buf))->machine,
machine(), 0, 0);
up_read(&uts_sem); up_read(&uts_sem);
return 0; return 0;
} }
...@@ -302,11 +294,11 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count) ...@@ -302,11 +294,11 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
} }
len = strlen(r) + 1; len = strlen(r) + 1;
if (count < len) { if (count < len) {
if (copy_to_user((char *)A(buf), r, count - 1) || if (copy_to_user(A(buf), r, count - 1) ||
__put_user(0, (char *)A(buf) + count - 1)) __put_user(0, (char __user *)A(buf) + count - 1))
return -EFAULT; return -EFAULT;
} else { } else {
if (copy_to_user((char *)A(buf), r, len)) if (copy_to_user(A(buf), r, len))
return -EFAULT; return -EFAULT;
} }
return len; return len;
...@@ -453,7 +445,7 @@ struct rlimit32 { ...@@ -453,7 +445,7 @@ struct rlimit32 {
u32 rlim_max; u32 rlim_max;
}; };
asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim) asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 __user *rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
...@@ -486,15 +478,15 @@ asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim) ...@@ -486,15 +478,15 @@ asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim)
return ret; return ret;
} }
asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim) asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 __user *rlim)
{ {
struct rlimit r, rold; struct rlimit r, rold;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
int (*sys_setrlimit)(unsigned int, struct rlimit *) = int (*sys_setrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(setrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(setrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -527,13 +519,13 @@ asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim) ...@@ -527,13 +519,13 @@ asmlinkage int solaris_setrlimit(unsigned int resource, struct rlimit32 *rlim)
return ret; return ret;
} }
asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim) asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -556,15 +548,15 @@ asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim) ...@@ -556,15 +548,15 @@ asmlinkage int solaris_getrlimit64(unsigned int resource, struct rlimit *rlim)
return ret; return ret;
} }
asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit *rlim) asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit __user *rlim)
{ {
struct rlimit r, rold; struct rlimit r, rold;
int ret; int ret;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
int (*sys_getrlimit)(unsigned int, struct rlimit *) = int (*sys_getrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(getrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(getrlimit);
int (*sys_setrlimit)(unsigned int, struct rlimit *) = int (*sys_setrlimit)(unsigned int, struct rlimit __user *) =
(int (*)(unsigned int, struct rlimit *))SYS(setrlimit); (int (*)(unsigned int, struct rlimit __user *))SYS(setrlimit);
if (resource > RLIMIT_SOL_VMEM) if (resource > RLIMIT_SOL_VMEM)
return -EINVAL; return -EINVAL;
...@@ -623,10 +615,10 @@ struct sol_timex { ...@@ -623,10 +615,10 @@ struct sol_timex {
s32 stbcnt; s32 stbcnt;
}; };
asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp) asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval __user *ntp)
{ {
int (*sys_adjtimex)(struct timex *) = int (*sys_adjtimex)(struct timex __user *) =
(int (*)(struct timex *))SYS(adjtimex); (int (*)(struct timex __user *))SYS(adjtimex);
struct timex t; struct timex t;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
...@@ -644,10 +636,10 @@ asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp) ...@@ -644,10 +636,10 @@ asmlinkage int solaris_ntp_gettime(struct sol_ntptimeval *ntp)
return ret; return ret;
} }
asmlinkage int solaris_ntp_adjtime(struct sol_timex *txp) asmlinkage int solaris_ntp_adjtime(struct sol_timex __user *txp)
{ {
int (*sys_adjtimex)(struct timex *) = int (*sys_adjtimex)(struct timex __user *) =
(int (*)(struct timex *))SYS(adjtimex); (int (*)(struct timex __user *))SYS(adjtimex);
struct timex t; struct timex t;
int ret, err; int ret, err;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
......
...@@ -76,8 +76,8 @@ static long sig_handler(int sig, u32 arg, int one_shot) ...@@ -76,8 +76,8 @@ static long sig_handler(int sig, u32 arg, int one_shot)
struct sigaction sa, old; struct sigaction sa, old;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_sigaction)(int,struct sigaction *,struct sigaction *) = int (*sys_sigaction)(int,struct sigaction __user *,struct sigaction __user *) =
(int (*)(int,struct sigaction *,struct sigaction *))SYS(sigaction); (int (*)(int,struct sigaction __user *,struct sigaction __user *))SYS(sigaction);
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_restorer = NULL; sa.sa_restorer = NULL;
...@@ -85,10 +85,10 @@ static long sig_handler(int sig, u32 arg, int one_shot) ...@@ -85,10 +85,10 @@ static long sig_handler(int sig, u32 arg, int one_shot)
sa.sa_flags = 0; sa.sa_flags = 0;
if (one_shot) sa.sa_flags = SA_ONESHOT | SA_NOMASK; if (one_shot) sa.sa_flags = SA_ONESHOT | SA_NOMASK;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sigaction(sig, &sa, &old); ret = sys_sigaction(sig, (void __user *)&sa, (void __user *)&old);
set_fs (old_fs); set_fs (old_fs);
if (ret < 0) return ret; if (ret < 0) return ret;
return (u32)(long)old.sa_handler; return (u32)(unsigned long)old.sa_handler;
} }
static inline long solaris_signal(int sig, u32 arg) static inline long solaris_signal(int sig, u32 arg)
...@@ -129,7 +129,7 @@ static inline long solaris_sigrelse(int sig) ...@@ -129,7 +129,7 @@ static inline long solaris_sigrelse(int sig)
static inline long solaris_sigignore(int sig) static inline long solaris_sigignore(int sig)
{ {
return sig_handler (sig, (u32)SIG_IGN, 0); return sig_handler(sig, (u32)(unsigned long)SIG_IGN, 0);
} }
static inline long solaris_sigpause(int sig) static inline long solaris_sigpause(int sig)
...@@ -207,21 +207,22 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out) ...@@ -207,21 +207,22 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out)
sigset_t in_s, *ins, out_s, *outs; sigset_t in_s, *ins, out_s, *outs;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
int (*sys_sigprocmask)(int,sigset_t *,sigset_t *) = int (*sys_sigprocmask)(int,sigset_t __user *,sigset_t __user *) =
(int (*)(int,sigset_t *,sigset_t *))SYS(sigprocmask); (int (*)(int,sigset_t __user *,sigset_t __user *))SYS(sigprocmask);
ins = NULL; outs = NULL; ins = NULL; outs = NULL;
if (in) { if (in) {
u32 tmp[2]; u32 tmp[2];
if (copy_from_user (tmp, (sol_sigset_t *)A(in), 2*sizeof(u32))) if (copy_from_user (tmp, (void __user *)A(in), 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
ins = &in_s; ins = &in_s;
if (mapin (tmp, ins)) return -EINVAL; if (mapin (tmp, ins)) return -EINVAL;
} }
if (out) outs = &out_s; if (out) outs = &out_s;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_sigprocmask((how == 3) ? SIG_SETMASK : how, ins, outs); ret = sys_sigprocmask((how == 3) ? SIG_SETMASK : how,
(void __user *)ins, (void __user *)outs);
set_fs (old_fs); set_fs (old_fs);
if (ret) return ret; if (ret) return ret;
if (out) { if (out) {
...@@ -229,7 +230,7 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out) ...@@ -229,7 +230,7 @@ asmlinkage int solaris_sigprocmask(int how, u32 in, u32 out)
tmp[2] = 0; tmp[3] = 0; tmp[2] = 0; tmp[3] = 0;
if (mapout (outs, tmp)) return -EINVAL; if (mapout (outs, tmp)) return -EINVAL;
if (copy_to_user((sol_sigset_t *)A(out), tmp, 4*sizeof(u32))) if (copy_to_user((void __user *)A(out), tmp, 4*sizeof(u32)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -240,7 +241,7 @@ asmlinkage long do_sol_sigsuspend(u32 mask) ...@@ -240,7 +241,7 @@ asmlinkage long do_sol_sigsuspend(u32 mask)
sigset_t s; sigset_t s;
u32 tmp[2]; u32 tmp[2];
if (copy_from_user (tmp, (sol_sigset_t *)A(mask), 2*sizeof(u32))) if (copy_from_user (tmp, (sol_sigset_t __user *)A(mask), 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
if (mapin (tmp, &s)) return -EINVAL; if (mapin (tmp, &s)) return -EINVAL;
return (long)s.sig[0]; return (long)s.sig[0];
...@@ -259,18 +260,19 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -259,18 +260,19 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
struct sigaction s, s2; struct sigaction s, s2;
int ret; int ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int (*sys_sigaction)(int,struct sigaction *,struct sigaction *) = struct sol_sigaction __user *p = (void __user *)A(old);
(int (*)(int,struct sigaction *,struct sigaction *))SYS(sigaction); int (*sys_sigaction)(int,struct sigaction __user *,struct sigaction __user *) =
(int (*)(int,struct sigaction __user *,struct sigaction __user *))SYS(sigaction);
sig = mapsig(sig); sig = mapsig(sig);
if (sig < 0) { if (sig < 0) {
/* We cheat a little bit for Solaris only signals */ /* We cheat a little bit for Solaris only signals */
if (old && clear_user((struct sol_sigaction *)A(old), sizeof(struct sol_sigaction))) if (old && clear_user(p, sizeof(struct sol_sigaction)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
if (act) { if (act) {
if (get_user (tmp, &((struct sol_sigaction *)A(act))->sa_flags)) if (get_user (tmp, &p->sa_flags))
return -EFAULT; return -EFAULT;
s.sa_flags = 0; s.sa_flags = 0;
if (tmp & SOLARIS_SA_ONSTACK) s.sa_flags |= SA_STACK; if (tmp & SOLARIS_SA_ONSTACK) s.sa_flags |= SA_STACK;
...@@ -278,15 +280,16 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -278,15 +280,16 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
if (tmp & SOLARIS_SA_NODEFER) s.sa_flags |= SA_NOMASK; if (tmp & SOLARIS_SA_NODEFER) s.sa_flags |= SA_NOMASK;
if (tmp & SOLARIS_SA_RESETHAND) s.sa_flags |= SA_ONESHOT; if (tmp & SOLARIS_SA_RESETHAND) s.sa_flags |= SA_ONESHOT;
if (tmp & SOLARIS_SA_NOCLDSTOP) s.sa_flags |= SA_NOCLDSTOP; if (tmp & SOLARIS_SA_NOCLDSTOP) s.sa_flags |= SA_NOCLDSTOP;
if (get_user (tmp, &((struct sol_sigaction *)A(act))->sa_handler) || if (get_user (tmp, &p->sa_handler) ||
copy_from_user (tmp2, &((struct sol_sigaction *)A(act))->sa_mask, 2*sizeof(u32))) copy_from_user (tmp2, &p->sa_mask, 2*sizeof(u32)))
return -EFAULT; return -EFAULT;
s.sa_handler = (__sighandler_t)A(tmp); s.sa_handler = (__sighandler_t)A(tmp);
if (mapin (tmp2, &s.sa_mask)) return -EINVAL; if (mapin (tmp2, &s.sa_mask)) return -EINVAL;
s.sa_restorer = 0; s.sa_restorer = NULL;
} }
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sigaction(sig, act ? &s : NULL, old ? &s2 : NULL); ret = sys_sigaction(sig, act ? (void __user *)&s : NULL,
old ? (void __user *)&s2 : NULL);
set_fs(old_fs); set_fs(old_fs);
if (ret) return ret; if (ret) return ret;
if (old) { if (old) {
...@@ -297,9 +300,9 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old) ...@@ -297,9 +300,9 @@ asmlinkage int solaris_sigaction(int sig, u32 act, u32 old)
if (s2.sa_flags & SA_NOMASK) tmp |= SOLARIS_SA_NODEFER; if (s2.sa_flags & SA_NOMASK) tmp |= SOLARIS_SA_NODEFER;
if (s2.sa_flags & SA_ONESHOT) tmp |= SOLARIS_SA_RESETHAND; if (s2.sa_flags & SA_ONESHOT) tmp |= SOLARIS_SA_RESETHAND;
if (s2.sa_flags & SA_NOCLDSTOP) tmp |= SOLARIS_SA_NOCLDSTOP; if (s2.sa_flags & SA_NOCLDSTOP) tmp |= SOLARIS_SA_NOCLDSTOP;
if (put_user (tmp, &((struct sol_sigaction *)A(old))->sa_flags) || if (put_user (tmp, &p->sa_flags) ||
__put_user ((u32)(long)s2.sa_handler, &((struct sol_sigaction *)A(old))->sa_handler) || __put_user ((u32)(unsigned long)s2.sa_handler, &p->sa_handler) ||
copy_to_user (&((struct sol_sigaction *)A(old))->sa_mask, tmp2, 4*sizeof(u32))) copy_to_user (&p->sa_mask, tmp2, 4*sizeof(u32)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -323,26 +326,27 @@ asmlinkage int solaris_sigpending(int which, u32 set) ...@@ -323,26 +326,27 @@ asmlinkage int solaris_sigpending(int which, u32 set)
} }
if (mapout (&s, tmp)) return -EINVAL; if (mapout (&s, tmp)) return -EINVAL;
tmp[2] = 0; tmp[3] = 0; tmp[2] = 0; tmp[3] = 0;
if (copy_to_user ((u32 *)A(set), tmp, sizeof(tmp))) if (copy_to_user ((u32 __user *)A(set), tmp, sizeof(tmp)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
asmlinkage int solaris_wait(u32 stat_loc) asmlinkage int solaris_wait(u32 stat_loc)
{ {
int (*sys_wait4)(pid_t,unsigned int *, int, struct rusage *) = unsigned __user *p = (unsigned __user *)A(stat_loc);
(int (*)(pid_t,unsigned int *, int, struct rusage *))SYS(wait4); int (*sys_wait4)(pid_t,unsigned __user *, int, struct rusage __user *) =
(int (*)(pid_t,unsigned __user *, int, struct rusage __user *))SYS(wait4);
int ret, status; int ret, status;
ret = sys_wait4(-1, (unsigned int *)A(stat_loc), WUNTRACED, NULL); ret = sys_wait4(-1, p, WUNTRACED, NULL);
if (ret >= 0 && stat_loc) { if (ret >= 0 && stat_loc) {
if (get_user (status, (unsigned int *)A(stat_loc))) if (get_user (status, p))
return -EFAULT; return -EFAULT;
if (((status - 1) & 0xffff) < 0xff) if (((status - 1) & 0xffff) < 0xff)
status = linux_to_solaris_signals[status & 0x7f] & 0x7f; status = linux_to_solaris_signals[status & 0x7f] & 0x7f;
else if ((status & 0xff) == 0x7f) else if ((status & 0xff) == 0x7f)
status = (linux_to_solaris_signals[(status >> 8) & 0xff] << 8) | 0x7f; status = (linux_to_solaris_signals[(status >> 8) & 0xff] << 8) | 0x7f;
if (__put_user (status, (unsigned int *)A(stat_loc))) if (__put_user (status, p))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -350,8 +354,8 @@ asmlinkage int solaris_wait(u32 stat_loc) ...@@ -350,8 +354,8 @@ asmlinkage int solaris_wait(u32 stat_loc)
asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options) asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options)
{ {
int (*sys_wait4)(pid_t,unsigned int *, int, struct rusage *) = int (*sys_wait4)(pid_t,unsigned __user *, int, struct rusage __user *) =
(int (*)(pid_t,unsigned int *, int, struct rusage *))SYS(wait4); (int (*)(pid_t,unsigned __user *, int, struct rusage __user *))SYS(wait4);
int opts, status, ret; int opts, status, ret;
switch (idtype) { switch (idtype) {
...@@ -364,12 +368,12 @@ asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options) ...@@ -364,12 +368,12 @@ asmlinkage int solaris_waitid(int idtype, s32 pid, u32 info, int options)
if (options & SOLARIS_WUNTRACED) opts |= WUNTRACED; if (options & SOLARIS_WUNTRACED) opts |= WUNTRACED;
if (options & SOLARIS_WNOHANG) opts |= WNOHANG; if (options & SOLARIS_WNOHANG) opts |= WNOHANG;
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
ret = sys_wait4(pid, (unsigned int *)A(info), opts, NULL); ret = sys_wait4(pid, (unsigned int __user *)A(info), opts, NULL);
if (ret < 0) return ret; if (ret < 0) return ret;
if (info) { if (info) {
struct sol_siginfo *s = (struct sol_siginfo *)A(info); struct sol_siginfo __user *s = (void __user *)A(info);
if (get_user (status, (unsigned int *)A(info))) if (get_user (status, (unsigned int __user *)A(info)))
return -EFAULT; return -EFAULT;
if (__put_user (SOLARIS_SIGCLD, &s->si_signo) || if (__put_user (SOLARIS_SIGCLD, &s->si_signo) ||
......
...@@ -132,18 +132,18 @@ asmlinkage int solaris_getsockopt(int fd, int level, int optname, u32 optval, u3 ...@@ -132,18 +132,18 @@ asmlinkage int solaris_getsockopt(int fd, int level, int optname, u32 optval, u3
return sunos_getsockopt(fd, level, optname, optval, optlen); return sunos_getsockopt(fd, level, optname, optval, optlen);
} }
asmlinkage int solaris_connect(int fd, struct sockaddr *addr, int addrlen) asmlinkage int solaris_connect(int fd, struct sockaddr __user *addr, int addrlen)
{ {
int (*sys_connect)(int, struct sockaddr *, int) = int (*sys_connect)(int, struct sockaddr __user *, int) =
(int (*)(int, struct sockaddr *, int))SYS(connect); (int (*)(int, struct sockaddr __user *, int))SYS(connect);
return sys_connect(fd, addr, addrlen); return sys_connect(fd, addr, addrlen);
} }
asmlinkage int solaris_accept(int fd, struct sockaddr *addr, int *addrlen) asmlinkage int solaris_accept(int fd, struct sockaddr __user *addr, int __user *addrlen)
{ {
int (*sys_accept)(int, struct sockaddr *, int *) = int (*sys_accept)(int, struct sockaddr __user *, int __user *) =
(int (*)(int, struct sockaddr *, int *))SYS(accept); (int (*)(int, struct sockaddr __user *, int __user *))SYS(accept);
return sys_accept(fd, addr, addrlen); return sys_accept(fd, addr, addrlen);
} }
...@@ -197,28 +197,28 @@ static int linux_to_solaris_msgflags(int flags) ...@@ -197,28 +197,28 @@ static int linux_to_solaris_msgflags(int flags)
return fl; return fl;
} }
asmlinkage int solaris_recvfrom(int s, char *buf, int len, int flags, u32 from, u32 fromlen) asmlinkage int solaris_recvfrom(int s, char __user *buf, int len, int flags, u32 from, u32 fromlen)
{ {
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(from), (int *)A(fromlen)); return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), A(from), A(fromlen));
} }
asmlinkage int solaris_recv(int s, char *buf, int len, int flags) asmlinkage int solaris_recv(int s, char __user *buf, int len, int flags)
{ {
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), NULL, NULL); return sys_recvfrom(s, buf, len, solaris_to_linux_msgflags(flags), NULL, NULL);
} }
asmlinkage int solaris_sendto(int s, char *buf, int len, int flags, u32 to, u32 tolen) asmlinkage int solaris_sendto(int s, char __user *buf, int len, int flags, u32 to, u32 tolen)
{ {
int (*sys_sendto)(int, void *, size_t, unsigned, struct sockaddr *, int *) = int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(sendto); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(sendto);
return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), (struct sockaddr *)A(to), (int *)A(tolen)); return sys_sendto(s, buf, len, solaris_to_linux_msgflags(flags), A(to), A(tolen));
} }
asmlinkage int solaris_send(int s, char *buf, int len, int flags) asmlinkage int solaris_send(int s, char *buf, int len, int flags)
...@@ -269,7 +269,7 @@ struct sol_cmsghdr { ...@@ -269,7 +269,7 @@ struct sol_cmsghdr {
}; };
static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
struct sol_nmsghdr *umsg) struct sol_nmsghdr __user *umsg)
{ {
u32 tmp1, tmp2, tmp3; u32 tmp1, tmp2, tmp3;
int err; int err;
...@@ -280,9 +280,9 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, ...@@ -280,9 +280,9 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
if (err) if (err)
return -EFAULT; return -EFAULT;
kmsg->msg_name = (void *)A(tmp1); kmsg->msg_name = A(tmp1);
kmsg->msg_iov = (struct iovec *)A(tmp2); kmsg->msg_iov = A(tmp2);
kmsg->msg_control = (void *)A(tmp3); kmsg->msg_control = A(tmp3);
err = get_user(kmsg->msg_namelen, &umsg->msg_namelen); err = get_user(kmsg->msg_namelen, &umsg->msg_namelen);
err |= get_user(kmsg->msg_controllen, &umsg->msg_controllen); err |= get_user(kmsg->msg_controllen, &umsg->msg_controllen);
...@@ -293,7 +293,7 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, ...@@ -293,7 +293,7 @@ static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg,
return err; return err;
} }
asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned user_flags) asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsigned user_flags)
{ {
struct socket *sock; struct socket *sock;
char address[MAX_SOCK_ADDR]; char address[MAX_SOCK_ADDR];
...@@ -313,7 +313,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -313,7 +313,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
total_len = err; total_len = err;
if(kern_msg.msg_controllen) { if(kern_msg.msg_controllen) {
struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control; struct sol_cmsghdr __user *ucmsg = kern_msg.msg_control;
unsigned long *kcmsg; unsigned long *kcmsg;
compat_size_t cmlen; compat_size_t cmlen;
...@@ -356,15 +356,15 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -356,15 +356,15 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
return err; return err;
} }
asmlinkage int solaris_recvmsg(int fd, struct sol_nmsghdr *user_msg, unsigned int user_flags) asmlinkage int solaris_recvmsg(int fd, struct sol_nmsghdr __user *user_msg, unsigned int user_flags)
{ {
struct iovec iovstack[UIO_FASTIOV]; struct iovec iovstack[UIO_FASTIOV];
struct msghdr kern_msg; struct msghdr kern_msg;
char addr[MAX_SOCK_ADDR]; char addr[MAX_SOCK_ADDR];
struct socket *sock; struct socket *sock;
struct iovec *iov = iovstack; struct iovec *iov = iovstack;
struct sockaddr *uaddr; struct sockaddr __user *uaddr;
int *uaddr_len; int __user *uaddr_len;
unsigned long cmsg_ptr; unsigned long cmsg_ptr;
int err, total_len, len = 0; int err, total_len, len = 0;
......
...@@ -219,7 +219,7 @@ static void timod_ok(unsigned int fd, int prim) ...@@ -219,7 +219,7 @@ static void timod_ok(unsigned int fd, int prim)
SOLD("done"); SOLD("done");
} }
static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len, int do_ret) static int timod_optmgmt(unsigned int fd, int flag, char __user *opt_buf, int opt_len, int do_ret)
{ {
int error, failed; int error, failed;
int ret_space, ret_len; int ret_space, ret_len;
...@@ -337,8 +337,8 @@ static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len, ...@@ -337,8 +337,8 @@ static int timod_optmgmt(unsigned int fd, int flag, char *opt_buf, int opt_len,
return 0; return 0;
} }
int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len,
char *data_buf, int data_len, int flags) char __user *data_buf, int data_len, int flags)
{ {
int ret, error, terror; int ret, error, terror;
char *buf; char *buf;
...@@ -347,15 +347,15 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -347,15 +347,15 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
struct sol_socket_struct *sock; struct sol_socket_struct *sock;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
long args[6]; long args[6];
int (*sys_socketcall)(int, unsigned long *) = int (*sys_socketcall)(int, unsigned long __user *) =
(int (*)(int, unsigned long *))SYS(socketcall); (int (*)(int, unsigned long __user *))SYS(socketcall);
int (*sys_sendto)(int, void *, size_t, unsigned, struct sockaddr *, int) = int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) =
(int (*)(int, void *, size_t, unsigned, struct sockaddr *, int))SYS(sendto); (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto);
filp = current->files->fd[fd]; filp = current->files->fd[fd];
ino = filp->f_dentry->d_inode; ino = filp->f_dentry->d_inode;
sock = (struct sol_socket_struct *)filp->private_data; sock = (struct sol_socket_struct *)filp->private_data;
SOLD("entry"); SOLD("entry");
if (get_user(ret, (int *)A(ctl_buf))) if (get_user(ret, (int __user *)A(ctl_buf)))
return -EFAULT; return -EFAULT;
switch (ret) { switch (ret) {
case T_BIND_REQ: case T_BIND_REQ:
...@@ -596,7 +596,7 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -596,7 +596,7 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
printk("\n"); printk("\n");
} }
#endif #endif
err = sys_sendto(fd, data_buf, data_len, 0, req.DEST_length > 0 ? (struct sockaddr*)(ctl_buf+req.DEST_offset) : NULL, req.DEST_length); err = sys_sendto(fd, data_buf, data_len, 0, req.DEST_length > 0 ? (struct sockaddr __user *)(ctl_buf+req.DEST_offset) : NULL, req.DEST_length);
if (err == data_len) if (err == data_len)
return 0; return 0;
if(err >= 0) { if(err >= 0) {
...@@ -613,8 +613,8 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len, ...@@ -613,8 +613,8 @@ int timod_putmsg(unsigned int fd, char *ctl_buf, int ctl_len,
return -EINVAL; return -EINVAL;
} }
int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __user *ctl_len,
char *data_buf, int data_maxlen, s32 *data_len, int *flags_p) char __user *data_buf, int data_maxlen, s32 __user *data_len, int *flags_p)
{ {
int error; int error;
int oldflags; int oldflags;
...@@ -624,11 +624,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, ...@@ -624,11 +624,11 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
struct T_unitdata_ind udi; struct T_unitdata_ind udi;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
long args[6]; long args[6];
char *tmpbuf; char __user *tmpbuf;
int tmplen; int tmplen;
int (*sys_socketcall)(int, unsigned long *) = int (*sys_socketcall)(int, unsigned long __user *) =
(int (*)(int, unsigned long *))SYS(socketcall); (int (*)(int, unsigned long __user *))SYS(socketcall);
int (*sys_recvfrom)(int, void *, size_t, unsigned, struct sockaddr *, int *); int (*sys_recvfrom)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *);
SOLD("entry"); SOLD("entry");
SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p));
...@@ -808,8 +808,8 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len, ...@@ -808,8 +808,8 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
oldflags = filp->f_flags; oldflags = filp->f_flags;
filp->f_flags |= O_NONBLOCK; filp->f_flags |= O_NONBLOCK;
SOLD("calling recvfrom"); SOLD("calling recvfrom");
sys_recvfrom = (int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom); sys_recvfrom = (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int __user *))SYS(recvfrom);
error = sys_recvfrom(fd, data_buf, data_maxlen, 0, (struct sockaddr*)tmpbuf, ctl_len); error = sys_recvfrom(fd, data_buf, data_maxlen, 0, (struct sockaddr __user *)tmpbuf, ctl_len);
filp->f_flags = oldflags; filp->f_flags = oldflags;
if (error < 0) if (error < 0)
return error; return error;
...@@ -838,9 +838,10 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -838,9 +838,10 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
{ {
struct file *filp; struct file *filp;
struct inode *ino; struct inode *ino;
struct strbuf *ctlptr, *datptr; struct strbuf __user *ctlptr;
struct strbuf __user *datptr;
struct strbuf ctl, dat; struct strbuf ctl, dat;
int *flgptr; int __user *flgptr;
int flags; int flags;
int error = -EBADF; int error = -EBADF;
...@@ -857,9 +858,9 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -857,9 +858,9 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
if (!ino->i_sock) if (!ino->i_sock)
goto out; goto out;
ctlptr = (struct strbuf *)A(arg1); ctlptr = (struct strbuf __user *)A(arg1);
datptr = (struct strbuf *)A(arg2); datptr = (struct strbuf __user *)A(arg2);
flgptr = (int *)A(arg3); flgptr = (int __user *)A(arg3);
error = -EFAULT; error = -EFAULT;
...@@ -891,8 +892,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -891,8 +892,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
goto out; goto out;
} }
error = timod_getmsg(fd,(char*)A(ctl.buf),ctl.maxlen,&ctlptr->len, error = timod_getmsg(fd,A(ctl.buf),ctl.maxlen,&ctlptr->len,
(char*)A(dat.buf),dat.maxlen,&datptr->len,&flags); A(dat.buf),dat.maxlen,&datptr->len,&flags);
if (!error && put_user(flags,flgptr)) if (!error && put_user(flags,flgptr))
error = -EFAULT; error = -EFAULT;
...@@ -906,7 +907,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -906,7 +907,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
{ {
struct file *filp; struct file *filp;
struct inode *ino; struct inode *ino;
struct strbuf *ctlptr, *datptr; struct strbuf __user *ctlptr;
struct strbuf __user *datptr;
struct strbuf ctl, dat; struct strbuf ctl, dat;
int flags = (int) arg3; int flags = (int) arg3;
int error = -EBADF; int error = -EBADF;
...@@ -925,8 +927,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -925,8 +927,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
(imajor(ino) != 30 || iminor(ino) != 1)) (imajor(ino) != 30 || iminor(ino) != 1))
goto out; goto out;
ctlptr = (struct strbuf *)A(arg1); ctlptr = A(arg1);
datptr = (struct strbuf *)A(arg2); datptr = A(arg2);
error = -EFAULT; error = -EFAULT;
...@@ -950,8 +952,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) ...@@ -950,8 +952,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
dat.buf = 0; dat.buf = 0;
} }
error = timod_putmsg(fd,(char*)A(ctl.buf),ctl.len, error = timod_putmsg(fd,A(ctl.buf),ctl.len,
(char*)A(dat.buf),dat.len,flags); A(dat.buf),dat.len,flags);
out: out:
unlock_kernel(); unlock_kernel();
SOLD("done"); SOLD("done");
......
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