Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e51ec241 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Kyle McMartin
Browse files

[PARISC] more sparse fixes



0/NULL changes, __user annotations, __iomem annotations

Signed-off-by: default avatarMatthew Wilcox <matthew@wil.cx>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent c2c4798e
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -35,13 +35,13 @@ int hpux_execve(struct pt_regs *regs)
	int error;
	char *filename;

	filename = getname((char *) regs->gr[26]);
	filename = getname((char __user *) regs->gr[26]);
	error = PTR_ERR(filename);
	if (IS_ERR(filename))
		goto out;

	error = do_execve(filename, (char **) regs->gr[25],
		(char **)regs->gr[24], regs);
	error = do_execve(filename, (char __user * __user *) regs->gr[25],
		(char __user * __user *) regs->gr[24], regs);

	if (error == 0) {
		task_lock(current);
@@ -63,19 +63,19 @@ struct hpux_dirent {
};

struct getdents_callback {
	struct hpux_dirent *current_dir;
	struct hpux_dirent *previous;
	struct hpux_dirent __user *current_dir;
	struct hpux_dirent __user *previous;
	int count;
	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))

static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
		u64 ino, unsigned d_type)
{
	struct hpux_dirent * dirent;
	struct hpux_dirent __user * dirent;
	struct getdents_callback * buf = (struct getdents_callback *) __buf;
	ino_t d_ino;
	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 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 hpux_dirent * lastdirent;
	struct hpux_dirent __user * lastdirent;
	struct getdents_callback buf;
	int error = -EBADF;

@@ -143,7 +143,7 @@ int hpux_mount(const char *fs, const char *path, int mflag,
	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;

@@ -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;
}

long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf)
{
	struct kstat stat;
	int error = vfs_stat(filename, &stat);
@@ -180,7 +180,7 @@ long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
	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;
	int error = vfs_fstat(fd, &stat);
@@ -191,7 +191,7 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
	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;
	int error = vfs_lstat(filename, &stat);
+17 −15
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ int hpux_ptrace(void)
	return -ENOSYS;
}

int hpux_wait(int *stat_loc)
int hpux_wait(int __user *stat_loc)
{
	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?
 *        (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;

@@ -300,14 +300,14 @@ static int hpux_uname(struct hpux_utsname *name)
/*  Note: HP-UX just uses the old suser() function to check perms
 *  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 error;
	switch( type ) {
	case 0:
		/*  uname():  */
		return( hpux_uname( (struct hpux_utsname *)ubuf ) );
		return hpux_uname((struct hpux_utsname __user *)ubuf);
		break ;
	case 1:
		/*  Obsolete (used to be umask().)  */
@@ -315,7 +315,8 @@ int hpux_utssys(char *ubuf, int n, int type)
		break ;
	case 2:
		/*  ustat():  */
		return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) );
		return hpux_ustat(new_decode_dev(n),
				  (struct hpux_ustat __user *)ubuf);
		break;
	case 3:
		/*  setuname():
@@ -332,7 +333,7 @@ int hpux_utssys(char *ubuf, int n, int type)
			return -EINVAL ;
		/*  Unlike Linux, HP-UX truncates it if n is too big:  */
		len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
		return( sys_sethostname(ubuf, len) );
		return sys_sethostname(ubuf, len);
		break ;
	case 4:
		/*  sethostname():
@@ -346,7 +347,7 @@ int hpux_utssys(char *ubuf, int n, int type)
			return -EINVAL ;
		/*  Unlike Linux, HP-UX truncates it if n is too big:  */
		len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
		return( sys_sethostname(ubuf, len) );
		return sys_sethostname(ubuf, len);
		break ;
	case 5:
		/*  gethostname():
@@ -356,7 +357,7 @@ int hpux_utssys(char *ubuf, int n, int type)
		/*  Unlike Linux, HP-UX returns an error if n==0:  */
		if ( n <= 0 )
			return -EINVAL ;
		return( sys_gethostname(ubuf, n) );
		return sys_gethostname(ubuf, n);
		break ;
	case 6:
		/*  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 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);

	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);
		if (len == 0)
			return 0;
		fsname = (char *) kmalloc(len, GFP_KERNEL);
		fsname = kmalloc(len, GFP_KERNEL);
		if (!fsname) {
			printk(KERN_DEBUG "failed to kmalloc fsname\n");
			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");
			kfree(fsname);
			return 0;
@@ -495,7 +497,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
			fstype = 0;
		} else {
			fstype = 0;
		};
		}

		kfree(fsname);

+1 −1
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ pcxl_dma_init(void)
	pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
					    get_order(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)
    		printk(KERN_WARNING
			"pcxl_dma_init: Unable to create gsc /proc dir entry\n");
+3 −3
Original line number Diff line number Diff line
@@ -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 *addr;
	void __iomem *addr;
	struct vm_struct *area;
	unsigned long offset, last_addr;

@@ -178,13 +178,13 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
	if (!area)
		return NULL;

	addr = area->addr;
	addr = (void __iomem *) area->addr;
	if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
		vfree(addr);
		return NULL;
	}

	return (void __iomem *) (offset + (char *)addr);
	return (void __iomem *) (offset + (char __iomem *)addr);
}
EXPORT_SYMBOL(__ioremap);