From 072ab23d10d2c4e814f12321e613400ae75415c3 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Fri, 28 May 2004 21:12:03 -0700 Subject: [PATCH] [PATCH] sparse: oprofile __user annotation --- drivers/oprofile/event_buffer.c | 2 +- drivers/oprofile/oprofile_files.c | 12 ++++++------ drivers/oprofile/oprofilefs.c | 12 ++++++------ include/linux/oprofile.h | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 3df72441fa79b..d8b1869241408 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c @@ -142,7 +142,7 @@ int event_buffer_release(struct inode * inode, struct file * file) } -ssize_t event_buffer_read(struct file * file, char * buf, size_t count, loff_t * offset) +ssize_t event_buffer_read(struct file * file, char __user * buf, size_t count, loff_t * offset) { int retval = -EINVAL; size_t const max = buffer_size * sizeof(unsigned long); diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c index b7466377afd4b..381abef6fc075 100644 --- a/drivers/oprofile/oprofile_files.c +++ b/drivers/oprofile/oprofile_files.c @@ -19,9 +19,9 @@ unsigned long fs_cpu_buffer_size = 8192; unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */ -static ssize_t pointer_size_read(struct file * file, char * buf, size_t count, loff_t * offset) +static ssize_t pointer_size_read(struct file * file, char __user * buf, size_t count, loff_t * offset) { - return oprofilefs_ulong_to_user((unsigned long)sizeof(void *), buf, count, offset); + return oprofilefs_ulong_to_user(sizeof(void *), buf, count, offset); } @@ -30,7 +30,7 @@ static struct file_operations pointer_size_fops = { }; -static ssize_t cpu_type_read(struct file * file, char * buf, size_t count, loff_t * offset) +static ssize_t cpu_type_read(struct file * file, char __user * buf, size_t count, loff_t * offset) { return oprofilefs_str_to_user(oprofile_ops->cpu_type, buf, count, offset); } @@ -41,13 +41,13 @@ static struct file_operations cpu_type_fops = { }; -static ssize_t enable_read(struct file * file, char * buf, size_t count, loff_t * offset) +static ssize_t enable_read(struct file * file, char __user * buf, size_t count, loff_t * offset) { return oprofilefs_ulong_to_user(oprofile_started, buf, count, offset); } -static ssize_t enable_write(struct file *file, char const * buf, size_t count, loff_t * offset) +static ssize_t enable_write(struct file *file, char const __user * buf, size_t count, loff_t * offset) { unsigned long val; int retval; @@ -76,7 +76,7 @@ static struct file_operations enable_fops = { }; -static ssize_t dump_write(struct file *file, char const * buf, size_t count, loff_t * offset) +static ssize_t dump_write(struct file *file, char const __user * buf, size_t count, loff_t * offset) { wake_up_buffer_waiter(); return count; diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index ed1efe61f6e31..2824c24c7f497 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c @@ -45,7 +45,7 @@ static struct super_operations s_ops = { }; -ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_t * offset) +ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset) { size_t len = strlen(str); @@ -69,7 +69,7 @@ ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_ #define TMPBUFSIZE 50 -ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, loff_t * offset) +ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset) { char tmpbuf[TMPBUFSIZE]; size_t maxlen; @@ -98,7 +98,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, lo } -int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count) +int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) { char tmpbuf[TMPBUFSIZE]; @@ -120,14 +120,14 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t cou } -static ssize_t ulong_read_file(struct file * file, char * buf, size_t count, loff_t * offset) +static ssize_t ulong_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset) { unsigned long * val = file->private_data; return oprofilefs_ulong_to_user(*val, buf, count, offset); } -static ssize_t ulong_write_file(struct file * file, char const * buf, size_t count, loff_t * offset) +static ssize_t ulong_write_file(struct file * file, char const __user * buf, size_t count, loff_t * offset) { unsigned long * value = file->private_data; int retval; @@ -211,7 +211,7 @@ int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, } -static ssize_t atomic_read_file(struct file * file, char * buf, size_t count, loff_t * offset) +static ssize_t atomic_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset) { atomic_t * val = file->private_data; return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset); diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 9555dd4d69fc4..80cfea0fa65f7 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h @@ -86,19 +86,19 @@ struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, * Write the given asciz string to the given user buffer @buf, updating *offset * appropriately. Returns bytes written or -EFAULT. */ -ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_t * offset); +ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset); /** * Convert an unsigned long value into ASCII and copy it to the user buffer @buf, * updating *offset appropriately. Returns bytes written or -EFAULT. */ -ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, loff_t * offset); +ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset); /** * Read an ASCII string for a number from a userspace buffer and fill *val on success. * Returns 0 on success, < 0 on error. */ -int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count); +int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count); /** lock for read/write safety */ extern spinlock_t oprofilefs_lock; -- 2.53.0