Commit c6d32902 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: trivial fs annotations

parent 4bb07ce3
......@@ -31,8 +31,8 @@ static int afs_file_readpage(struct file *file, struct page *page);
static int afs_file_invalidatepage(struct page *page, unsigned long offset);
static int afs_file_releasepage(struct page *page, int gfp_flags);
static ssize_t afs_file_write(struct file *file, const char *buf, size_t size,
loff_t *off);
static ssize_t afs_file_write(struct file *file, const char __user *buf,
size_t size, loff_t *off);
struct inode_operations afs_file_inode_operations = {
.getattr = afs_inode_getattr,
......@@ -61,8 +61,8 @@ struct address_space_operations afs_fs_aops = {
/*
* AFS file write
*/
static ssize_t afs_file_write(struct file *file, const char *buf, size_t size,
loff_t *off)
static ssize_t afs_file_write(struct file *file, const char __user *buf,
size_t size, loff_t *off)
{
struct afs_vnode *vnode;
......
......@@ -27,7 +27,7 @@ static void *afs_proc_cells_start(struct seq_file *p, loff_t *pos);
static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos);
static void afs_proc_cells_stop(struct seq_file *p, void *v);
static int afs_proc_cells_show(struct seq_file *m, void *v);
static ssize_t afs_proc_cells_write(struct file *file, const char *buf,
static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
size_t size, loff_t *_pos);
static struct seq_operations afs_proc_cells_ops = {
......@@ -47,9 +47,10 @@ static struct file_operations afs_proc_cells_fops = {
static int afs_proc_rootcell_open(struct inode *inode, struct file *file);
static int afs_proc_rootcell_release(struct inode *inode, struct file *file);
static ssize_t afs_proc_rootcell_read(struct file *file, char *buf,
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
size_t size, loff_t *_pos);
static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf,
static ssize_t afs_proc_rootcell_write(struct file *file,
const char __user *buf,
size_t size, loff_t *_pos);
static struct file_operations afs_proc_rootcell_fops = {
......@@ -278,7 +279,7 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
* handle writes to /proc/fs/afs/cells
* - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
*/
static ssize_t afs_proc_cells_write(struct file *file, const char *buf,
static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
size_t size, loff_t *_pos)
{
char *kbuf, *name, *args;
......@@ -363,7 +364,7 @@ static int afs_proc_rootcell_release(struct inode *inode, struct file *file)
return 0;
}
static ssize_t afs_proc_rootcell_read(struct file *file, char *buf,
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
size_t size, loff_t *_pos)
{
return 0;
......@@ -374,7 +375,8 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char *buf,
* handle writes to /proc/fs/afs/rootcell
* - to initialize rootcell: echo "cell.name:192.168.231.14"
*/
static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf,
static ssize_t afs_proc_rootcell_write(struct file *file,
const char __user *buf,
size_t size, loff_t *_pos)
{
char *kbuf, *s;
......
......@@ -196,7 +196,7 @@ static int unquote(char *from)
* ':name:type:offset:magic:mask:interpreter:'
* where the ':' is the IFS, that can be chosen with the first char
*/
static Node *create_entry(const char *buffer, size_t count)
static Node *create_entry(const char __user *buffer, size_t count)
{
Node *e;
int memsize, err;
......@@ -319,7 +319,7 @@ static Node *create_entry(const char *buffer, size_t count)
* Set status of entry/binfmt_misc:
* '1' enables, '0' disables and '-1' clears entry/binfmt_misc
*/
static int parse_command(const char *buffer, size_t count)
static int parse_command(const char __user *buffer, size_t count)
{
char s[4];
......@@ -424,7 +424,7 @@ static void kill_node(Node *e)
/* /<entry> */
static ssize_t
bm_entry_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
Node *e = file->f_dentry->d_inode->u.generic_ip;
loff_t pos = *ppos;
......@@ -456,7 +456,7 @@ bm_entry_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
return res;
}
static ssize_t bm_entry_write(struct file *file, const char *buffer,
static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
struct dentry *root;
......@@ -488,7 +488,7 @@ static struct file_operations bm_entry_operations = {
/* /register */
static ssize_t bm_register_write(struct file *file, const char *buffer,
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
Node *e;
......@@ -556,7 +556,7 @@ static struct file_operations bm_register_operations = {
/* /status */
static ssize_t
bm_status_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
char *s = enabled ? "enabled" : "disabled";
int len = strlen(s);
......@@ -574,7 +574,7 @@ bm_status_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
return nbytes;
}
static ssize_t bm_status_write(struct file * file, const char * buffer,
static ssize_t bm_status_write(struct file * file, const char __user * buffer,
size_t count, loff_t *ppos)
{
int res = parse_command(buffer, count);
......
......@@ -848,13 +848,13 @@ static unsigned int boot_options = OPTION_NONE;
static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir,
const char *name, int namelen,
int traverse_symlink);
static ssize_t devfsd_read(struct file *file, char *buf, size_t len,
static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
loff_t * ppos);
static int devfsd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int devfsd_close(struct inode *inode, struct file *file);
#ifdef CONFIG_DEVFS_DEBUG
static ssize_t stat_read(struct file *file, char *buf, size_t len,
static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
loff_t * ppos);
static struct file_operations stat_fops = {
.read = stat_read,
......@@ -2579,7 +2579,7 @@ static struct file_system_type devfs_fs_type = {
/* File operations for devfsd follow */
static ssize_t devfsd_read(struct file *file, char *buf, size_t len,
static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
loff_t * ppos)
{
int done = FALSE;
......@@ -2693,7 +2693,7 @@ static int devfsd_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case DEVFSDIOC_GET_PROTO_REV:
ival = DEVFSD_PROTOCOL_REVISION_KERNEL;
if (copy_to_user((void *)arg, &ival, sizeof ival))
if (copy_to_user((void __user *)arg, &ival, sizeof ival))
return -EFAULT;
break;
case DEVFSDIOC_SET_EVENT_MASK:
......@@ -2732,7 +2732,7 @@ static int devfsd_ioctl(struct inode *inode, struct file *file,
/*break; */
#ifdef CONFIG_DEVFS_DEBUG
case DEVFSDIOC_SET_DEBUG_MASK:
if (copy_from_user(&ival, (void *)arg, sizeof ival))
if (copy_from_user(&ival, (void __user *)arg, sizeof ival))
return -EFAULT;
devfs_debug = ival;
break;
......@@ -2772,7 +2772,7 @@ static int devfsd_close(struct inode *inode, struct file *file)
} /* End Function devfsd_close */
#ifdef CONFIG_DEVFS_DEBUG
static ssize_t stat_read(struct file *file, char *buf, size_t len,
static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
loff_t * ppos)
{
ssize_t num;
......
......@@ -26,7 +26,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
switch (cmd) {
case EXT3_IOC_GETFLAGS:
flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
return put_user(flags, (int *) arg);
return put_user(flags, (int __user *) arg);
case EXT3_IOC_SETFLAGS: {
handle_t *handle = NULL;
int err;
......@@ -40,7 +40,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
return -EACCES;
if (get_user(flags, (int *) arg))
if (get_user(flags, (int __user *) arg))
return -EFAULT;
if (!S_ISDIR(inode->i_mode))
......@@ -100,7 +100,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
}
case EXT3_IOC_GETVERSION:
case EXT3_IOC_GETVERSION_OLD:
return put_user(inode->i_generation, (int *) arg);
return put_user(inode->i_generation, (int __user *) arg);
case EXT3_IOC_SETVERSION:
case EXT3_IOC_SETVERSION_OLD: {
handle_t *handle;
......@@ -112,7 +112,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
return -EPERM;
if (IS_RDONLY(inode))
return -EROFS;
if (get_user(generation, (int *) arg))
if (get_user(generation, (int __user *) arg))
return -EFAULT;
handle = ext3_journal_start(inode, 1);
......
......@@ -31,7 +31,7 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
flags |= EXT2_FLAG_APPEND; /* EXT2_APPEND_FL */
if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP)
flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
return put_user(flags, (int *)arg);
return put_user(flags, (int __user *)arg);
case HFSPLUS_IOC_EXT2_SETFLAGS: {
if (IS_RDONLY(inode))
return -EROFS;
......@@ -39,7 +39,7 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
return -EACCES;
if (get_user(flags, (int *)arg))
if (get_user(flags, (int __user *)arg))
return -EFAULT;
if (flags & (EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND) ||
......
......@@ -1582,7 +1582,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
struct jffs_fmcontrol *fmc = c->fmc;
printk("Flash status -- ");
if (!access_ok(VERIFY_WRITE,
(struct jffs_flash_status *)arg,
(struct jffs_flash_status __user *)arg,
sizeof(struct jffs_flash_status))) {
D(printk("jffs_ioctl(): Bad arg in "
"JFFS_GET_STATUS ioctl!\n"));
......@@ -1598,7 +1598,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
"begin: %d, end: %d\n",
fst.size, fst.used, fst.dirty,
fst.begin, fst.end);
if (copy_to_user((struct jffs_flash_status *)arg,
if (copy_to_user((struct jffs_flash_status __user *)arg,
&fst,
sizeof(struct jffs_flash_status))) {
ret = -EFAULT;
......
......@@ -99,7 +99,7 @@ int ncp_make_open(struct inode *inode, int right)
}
static ssize_t
ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos)
ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
......@@ -187,7 +187,7 @@ ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
static ssize_t
ncp_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
......
......@@ -1002,7 +1002,7 @@ ncp_read_kernel(struct ncp_server *server, const char *file_id,
*/
int
ncp_read_bounce(struct ncp_server *server, const char *file_id,
__u32 offset, __u16 to_read, char *target, int *bytes_read,
__u32 offset, __u16 to_read, char __user *target, int *bytes_read,
void* bounce, __u32 bufsize)
{
int result;
......
......@@ -56,7 +56,7 @@ static inline int ncp_read_bounce_size(__u32 size) {
return sizeof(struct ncp_reply_header) + 2 + 2 + size + 8;
};
int ncp_read_bounce(struct ncp_server *, const char *, __u32, __u16,
char *, int *, void* bounce, __u32 bouncelen);
char __user *, int *, void* bounce, __u32 bouncelen);
int ncp_read_kernel(struct ncp_server *, const char *, __u32, __u16,
char *, int *);
int ncp_write_kernel(struct ncp_server *, const char *, __u32, __u16,
......
......@@ -466,7 +466,7 @@ nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
* cache.
*/
ssize_t
nfs_file_direct_read(struct kiocb *iocb, char *buf, size_t count, loff_t pos)
nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
{
ssize_t retval = -EINVAL;
loff_t *ppos = &iocb->ki_pos;
......@@ -546,7 +546,7 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count,
struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host;
struct iovec iov = {
.iov_base = buf,
.iov_base = (char __user *)buf,
.iov_len = count,
};
......
......@@ -1162,7 +1162,7 @@ static struct inode_operations proc_task_inode_operations = {
};
#ifdef CONFIG_SECURITY
static ssize_t proc_pid_attr_read(struct file * file, char * buf,
static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
struct inode * inode = file->f_dentry->d_inode;
......@@ -1199,7 +1199,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char * buf,
return count;
}
static ssize_t proc_pid_attr_write(struct file * file, const char * buf,
static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
{
struct inode * inode = file->f_dentry->d_inode;
......
......@@ -215,7 +215,7 @@ smb_updatepage(struct file *file, struct page *page, unsigned long offset,
}
static ssize_t
smb_file_read(struct file * file, char * buf, size_t count, loff_t *ppos)
smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos)
{
struct dentry * dentry = file->f_dentry;
ssize_t status;
......@@ -318,7 +318,7 @@ struct address_space_operations smb_file_aops = {
* Write to a file (through the page cache).
*/
static ssize_t
smb_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
struct dentry * dentry = file->f_dentry;
ssize_t result;
......
......@@ -35,11 +35,11 @@ smb_ioctl(struct inode *inode, struct file *filp,
uid_t uid32;
case SMB_IOC_GETMOUNTUID:
SET_UID(uid16, server->mnt->mounted_uid);
result = put_user(uid16, (uid16_t *) arg);
result = put_user(uid16, (uid16_t __user *) arg);
break;
case SMB_IOC_GETMOUNTUID32:
SET_UID(uid32, server->mnt->mounted_uid);
result = put_user(uid32, (uid_t *) arg);
result = put_user(uid32, (uid_t __user *) arg);
break;
case SMB_IOC_NEWCONN:
......@@ -56,7 +56,7 @@ smb_ioctl(struct inode *inode, struct file *filp,
}
result = -EFAULT;
if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
if (!copy_from_user(&opt, (void __user *)arg, sizeof(opt)))
result = smb_newconn(server, &opt);
break;
default:
......
......@@ -54,7 +54,7 @@ static int smbiod_start(void);
/*
* called when there's work for us to do
*/
void smbiod_wake_up()
void smbiod_wake_up(void)
{
if (smbiod_state == SMBIOD_DEAD)
return;
......
......@@ -109,7 +109,7 @@ struct address_space_operations udf_adinicb_aops = {
.commit_write = udf_adinicb_commit_write,
};
static ssize_t udf_file_write(struct file * file, const char * buf,
static ssize_t udf_file_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
{
ssize_t retval;
......@@ -204,26 +204,26 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
switch (cmd)
{
case UDF_GETVOLIDENT:
return copy_to_user((char *)arg,
return copy_to_user((char __user *)arg,
UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0;
case UDF_RELOCATE_BLOCKS:
{
long old, new;
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
if (get_user(old, (long *)arg)) return -EFAULT;
if (get_user(old, (long __user *)arg)) return -EFAULT;
if ((result = udf_relocate_blocks(inode->i_sb,
old, &new)) == 0)
result = put_user(new, (long *)arg);
result = put_user(new, (long __user *)arg);
return result;
}
case UDF_GETEASIZE:
result = put_user(UDF_I_LENEATTR(inode), (int *)arg);
result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
break;
case UDF_GETEABLOCK:
result = copy_to_user((char *)arg, UDF_I_DATA(inode),
result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
break;
}
......
......@@ -306,7 +306,7 @@ nfs_file_cred(struct file *file)
*/
extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
unsigned long);
extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char *buf,
extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf,
size_t count, loff_t pos);
extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf,
size_t count, loff_t pos);
......
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