mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-26 18:43:33 -05:00
[PARISC] more sparse fixes
0/NULL changes, __user annotations, __iomem annotations Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
parent
c2c4798e04
commit
e51ec24178
4 changed files with 34 additions and 32 deletions
|
@ -35,13 +35,13 @@ int hpux_execve(struct pt_regs *regs)
|
||||||
int error;
|
int error;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename = getname((char *) regs->gr[26]);
|
filename = getname((char __user *) regs->gr[26]);
|
||||||
error = PTR_ERR(filename);
|
error = PTR_ERR(filename);
|
||||||
if (IS_ERR(filename))
|
if (IS_ERR(filename))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
error = do_execve(filename, (char **) regs->gr[25],
|
error = do_execve(filename, (char __user * __user *) regs->gr[25],
|
||||||
(char **)regs->gr[24], regs);
|
(char __user * __user *) regs->gr[24], regs);
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
task_lock(current);
|
task_lock(current);
|
||||||
|
@ -63,19 +63,19 @@ struct hpux_dirent {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct getdents_callback {
|
struct getdents_callback {
|
||||||
struct hpux_dirent *current_dir;
|
struct hpux_dirent __user *current_dir;
|
||||||
struct hpux_dirent *previous;
|
struct hpux_dirent __user *previous;
|
||||||
int count;
|
int count;
|
||||||
int error;
|
int error;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
|
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
|
||||||
#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
|
#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
|
||||||
|
|
||||||
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
||||||
u64 ino, unsigned d_type)
|
u64 ino, unsigned d_type)
|
||||||
{
|
{
|
||||||
struct hpux_dirent * dirent;
|
struct hpux_dirent __user * dirent;
|
||||||
struct getdents_callback * buf = (struct getdents_callback *) __buf;
|
struct getdents_callback * buf = (struct getdents_callback *) __buf;
|
||||||
ino_t d_ino;
|
ino_t d_ino;
|
||||||
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
|
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
|
||||||
|
@ -105,10 +105,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
||||||
#undef NAME_OFFSET
|
#undef NAME_OFFSET
|
||||||
#undef ROUND_UP
|
#undef ROUND_UP
|
||||||
|
|
||||||
int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count)
|
int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
|
||||||
{
|
{
|
||||||
struct file * file;
|
struct file * file;
|
||||||
struct hpux_dirent * lastdirent;
|
struct hpux_dirent __user * lastdirent;
|
||||||
struct getdents_callback buf;
|
struct getdents_callback buf;
|
||||||
int error = -EBADF;
|
int error = -EBADF;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ int hpux_mount(const char *fs, const char *path, int mflag,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
|
static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
|
||||||
{
|
{
|
||||||
struct hpux_stat64 tmp;
|
struct hpux_stat64 tmp;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
|
||||||
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
|
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
|
long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf)
|
||||||
{
|
{
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
int error = vfs_stat(filename, &stat);
|
int error = vfs_stat(filename, &stat);
|
||||||
|
@ -180,7 +180,7 @@ long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
|
long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
|
||||||
{
|
{
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
int error = vfs_fstat(fd, &stat);
|
int error = vfs_fstat(fd, &stat);
|
||||||
|
@ -191,7 +191,7 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf)
|
long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf)
|
||||||
{
|
{
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
int error = vfs_lstat(filename, &stat);
|
int error = vfs_lstat(filename, &stat);
|
||||||
|
|
|
@ -61,7 +61,7 @@ int hpux_ptrace(void)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hpux_wait(int *stat_loc)
|
int hpux_wait(int __user *stat_loc)
|
||||||
{
|
{
|
||||||
return sys_waitpid(-1, stat_loc, 0);
|
return sys_waitpid(-1, stat_loc, 0);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
|
||||||
/* TODO: Are these put_user calls OK? Should they pass an int?
|
/* TODO: Are these put_user calls OK? Should they pass an int?
|
||||||
* (I copied it from sys_i386.c like this.)
|
* (I copied it from sys_i386.c like this.)
|
||||||
*/
|
*/
|
||||||
static int hpux_uname(struct hpux_utsname *name)
|
static int hpux_uname(struct hpux_utsname __user *name)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -300,14 +300,14 @@ static int hpux_uname(struct hpux_utsname *name)
|
||||||
/* Note: HP-UX just uses the old suser() function to check perms
|
/* Note: HP-UX just uses the old suser() function to check perms
|
||||||
* in this system call. We'll use capable(CAP_SYS_ADMIN).
|
* in this system call. We'll use capable(CAP_SYS_ADMIN).
|
||||||
*/
|
*/
|
||||||
int hpux_utssys(char *ubuf, int n, int type)
|
int hpux_utssys(char __user *ubuf, int n, int type)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int error;
|
int error;
|
||||||
switch( type ) {
|
switch( type ) {
|
||||||
case 0:
|
case 0:
|
||||||
/* uname(): */
|
/* uname(): */
|
||||||
return( hpux_uname( (struct hpux_utsname *)ubuf ) );
|
return hpux_uname((struct hpux_utsname __user *)ubuf);
|
||||||
break ;
|
break ;
|
||||||
case 1:
|
case 1:
|
||||||
/* Obsolete (used to be umask().) */
|
/* Obsolete (used to be umask().) */
|
||||||
|
@ -315,8 +315,9 @@ int hpux_utssys(char *ubuf, int n, int type)
|
||||||
break ;
|
break ;
|
||||||
case 2:
|
case 2:
|
||||||
/* ustat(): */
|
/* ustat(): */
|
||||||
return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) );
|
return hpux_ustat(new_decode_dev(n),
|
||||||
break ;
|
(struct hpux_ustat __user *)ubuf);
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
/* setuname():
|
/* setuname():
|
||||||
*
|
*
|
||||||
|
@ -332,7 +333,7 @@ int hpux_utssys(char *ubuf, int n, int type)
|
||||||
return -EINVAL ;
|
return -EINVAL ;
|
||||||
/* Unlike Linux, HP-UX truncates it if n is too big: */
|
/* Unlike Linux, HP-UX truncates it if n is too big: */
|
||||||
len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
|
len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
|
||||||
return( sys_sethostname(ubuf, len) );
|
return sys_sethostname(ubuf, len);
|
||||||
break ;
|
break ;
|
||||||
case 4:
|
case 4:
|
||||||
/* sethostname():
|
/* sethostname():
|
||||||
|
@ -346,7 +347,7 @@ int hpux_utssys(char *ubuf, int n, int type)
|
||||||
return -EINVAL ;
|
return -EINVAL ;
|
||||||
/* Unlike Linux, HP-UX truncates it if n is too big: */
|
/* Unlike Linux, HP-UX truncates it if n is too big: */
|
||||||
len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
|
len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
|
||||||
return( sys_sethostname(ubuf, len) );
|
return sys_sethostname(ubuf, len);
|
||||||
break ;
|
break ;
|
||||||
case 5:
|
case 5:
|
||||||
/* gethostname():
|
/* gethostname():
|
||||||
|
@ -356,7 +357,7 @@ int hpux_utssys(char *ubuf, int n, int type)
|
||||||
/* Unlike Linux, HP-UX returns an error if n==0: */
|
/* Unlike Linux, HP-UX returns an error if n==0: */
|
||||||
if ( n <= 0 )
|
if ( n <= 0 )
|
||||||
return -EINVAL ;
|
return -EINVAL ;
|
||||||
return( sys_gethostname(ubuf, n) );
|
return sys_gethostname(ubuf, n);
|
||||||
break ;
|
break ;
|
||||||
case 6:
|
case 6:
|
||||||
/* Supposedly called from setuname() in libc.
|
/* Supposedly called from setuname() in libc.
|
||||||
|
@ -420,7 +421,7 @@ int hpux_utssys(char *ubuf, int n, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hpux_getdomainname(char *name, int len)
|
int hpux_getdomainname(char __user *name, int len)
|
||||||
{
|
{
|
||||||
int nlen;
|
int nlen;
|
||||||
int err = -EFAULT;
|
int err = -EFAULT;
|
||||||
|
@ -471,17 +472,18 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
|
||||||
printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1);
|
printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1);
|
||||||
|
|
||||||
if ( opcode == 1 ) { /* GETFSIND */
|
if ( opcode == 1 ) { /* GETFSIND */
|
||||||
len = strlen_user((char *)arg1);
|
char __user *user_fsname = (char __user *)arg1;
|
||||||
|
len = strlen_user(user_fsname);
|
||||||
printk(KERN_DEBUG "len of arg1 = %d\n", len);
|
printk(KERN_DEBUG "len of arg1 = %d\n", len);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
fsname = (char *) kmalloc(len, GFP_KERNEL);
|
fsname = kmalloc(len, GFP_KERNEL);
|
||||||
if ( !fsname ) {
|
if (!fsname) {
|
||||||
printk(KERN_DEBUG "failed to kmalloc fsname\n");
|
printk(KERN_DEBUG "failed to kmalloc fsname\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( copy_from_user(fsname, (char *)arg1, len) ) {
|
if (copy_from_user(fsname, user_fsname, len)) {
|
||||||
printk(KERN_DEBUG "failed to copy_from_user fsname\n");
|
printk(KERN_DEBUG "failed to copy_from_user fsname\n");
|
||||||
kfree(fsname);
|
kfree(fsname);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -495,7 +497,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
|
||||||
fstype = 0;
|
fstype = 0;
|
||||||
} else {
|
} else {
|
||||||
fstype = 0;
|
fstype = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
kfree(fsname);
|
kfree(fsname);
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ pcxl_dma_init(void)
|
||||||
pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
|
pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
|
||||||
get_order(pcxl_res_size));
|
get_order(pcxl_res_size));
|
||||||
memset(pcxl_res_map, 0, pcxl_res_size);
|
memset(pcxl_res_map, 0, pcxl_res_size);
|
||||||
proc_gsc_root = proc_mkdir("gsc", 0);
|
proc_gsc_root = proc_mkdir("gsc", NULL);
|
||||||
if (!proc_gsc_root)
|
if (!proc_gsc_root)
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"pcxl_dma_init: Unable to create gsc /proc dir entry\n");
|
"pcxl_dma_init: Unable to create gsc /proc dir entry\n");
|
||||||
|
|
|
@ -128,7 +128,7 @@ remap_area_pages(unsigned long address, unsigned long phys_addr,
|
||||||
*/
|
*/
|
||||||
void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
|
void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
|
||||||
{
|
{
|
||||||
void *addr;
|
void __iomem *addr;
|
||||||
struct vm_struct *area;
|
struct vm_struct *area;
|
||||||
unsigned long offset, last_addr;
|
unsigned long offset, last_addr;
|
||||||
|
|
||||||
|
@ -178,13 +178,13 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
|
||||||
if (!area)
|
if (!area)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
addr = area->addr;
|
addr = (void __iomem *) area->addr;
|
||||||
if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
|
if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
|
||||||
vfree(addr);
|
vfree(addr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void __iomem *) (offset + (char *)addr);
|
return (void __iomem *) (offset + (char __iomem *)addr);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__ioremap);
|
EXPORT_SYMBOL(__ioremap);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue