From 3569e8460a074bd73c8a3662c85172c4b86a7af5 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Thu, 3 Jun 2004 17:23:33 -0700 Subject: [PATCH] [PATCH] sparse: misc drivers annotations assorted minor bits in drivers/* - all independent, but there's some limit to splitting stuff... --- drivers/char/nvram.c | 4 ++-- drivers/char/scx200_gpio.c | 4 ++-- drivers/char/toshiba.c | 7 ++++--- drivers/char/watchdog/pcwd.c | 19 ++++++++++--------- drivers/cpufreq/proc_intf.c | 2 +- drivers/media/common/saa7146_fops.c | 2 +- drivers/scsi/aha152x.c | 4 ++-- include/asm-i386/floppy.h | 2 +- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 7b6ee59edf081..b5f32d65e5453 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -250,7 +250,7 @@ static loff_t nvram_llseek(struct file *file,loff_t offset, int origin ) } static ssize_t -nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) +nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; @@ -279,7 +279,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) } static ssize_t -nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 3758fb1b11717..e937346e162b4 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c @@ -26,7 +26,7 @@ static int major = 0; /* default to dynamic major */ MODULE_PARM(major, "i"); MODULE_PARM_DESC(major, "Major device number"); -static ssize_t scx200_gpio_write(struct file *file, const char *data, +static ssize_t scx200_gpio_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); @@ -77,7 +77,7 @@ static ssize_t scx200_gpio_write(struct file *file, const char *data, return len; } -static ssize_t scx200_gpio_read(struct file *file, char *buf, +static ssize_t scx200_gpio_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 15e2c72ed0878..5b84af027d6a6 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c @@ -251,13 +251,14 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { SMMRegisters regs; + SMMRegisters __user *argp = (SMMRegisters __user *)arg; unsigned short ax,bx; int err; - if (!arg) + if (!argp) return -EINVAL; - if (copy_from_user(®s, (SMMRegisters *) arg, sizeof(SMMRegisters))) + if (copy_from_user(®s, argp, sizeof(SMMRegisters))) return -EFAULT; switch (cmd) { @@ -281,7 +282,7 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, return -EINVAL; } - if (copy_to_user((SMMRegisters *) arg, ®s, sizeof(SMMRegisters))) + if (copy_to_user(argp, ®s, sizeof(SMMRegisters))) return -EFAULT; return (err==0) ? 0:-EINVAL; diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index bd24b53480f4a..3831614d68f42 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c @@ -404,6 +404,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, int status; int temperature; int new_heartbeat; + int __user *argp = (int __user *)arg; static struct watchdog_info ident = { .options = WDIOF_OVERHEAT | WDIOF_CARDRESET | @@ -419,27 +420,27 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - if(copy_to_user((void*)arg, &ident, sizeof(ident))) + if(copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; return 0; case WDIOC_GETSTATUS: pcwd_get_status(&status); - return put_user(status, (int *) arg); + return put_user(status, argp); case WDIOC_GETBOOTSTATUS: - return put_user(initial_status, (int *) arg); + return put_user(initial_status, argp); case WDIOC_GETTEMP: if (pcwd_get_temperature(&temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, argp); case WDIOC_SETOPTIONS: if (revision == PCWD_REVISION_C) { - if(copy_from_user(&rv, (int*) arg, sizeof(int))) + if(copy_from_user(&rv, argp, sizeof(int))) return -EFAULT; if (rv & WDIOS_DISABLECARD) @@ -464,7 +465,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, argp)) return -EFAULT; if (pcwd_set_heartbeat(new_heartbeat)) @@ -474,13 +475,13 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, argp); } return 0; } -static ssize_t pcwd_write(struct file *file, const char *buf, size_t len, +static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -541,7 +542,7 @@ static int pcwd_close(struct inode *inode, struct file *file) * /dev/temperature handling */ -static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count, +static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int temperature; diff --git a/drivers/cpufreq/proc_intf.c b/drivers/cpufreq/proc_intf.c index 81d58c7b74ccb..a0eaf6f1d4249 100644 --- a/drivers/cpufreq/proc_intf.c +++ b/drivers/cpufreq/proc_intf.c @@ -164,7 +164,7 @@ end: */ static int cpufreq_proc_write ( struct file *file, - const char *buffer, + const char __user *buffer, unsigned long count, void *data) { diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 26995e2d5d465..a61e91ac7951a 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -396,7 +396,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) return 0; } -static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos) +static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) { struct saa7146_fh *fh = file->private_data; diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 6e9d28f8fd0e9..6a5291b65ad15 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -577,11 +577,11 @@ struct aha152x_scdata { #define MSGO(i) (HOSTDATA(shpnt)->msgo[i]) #define MSGO_I (HOSTDATA(shpnt)->msgo_i) #define MSGOLEN (HOSTDATA(shpnt)->msgo_len) -#define ADDMSGO(x) (MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow")) +#define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow")) #define MSGI(i) (HOSTDATA(shpnt)->msgi[i]) #define MSGILEN (HOSTDATA(shpnt)->msgi_len) -#define ADDMSGI(x) (MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow")) +#define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow")) #define DATA_LEN (HOSTDATA(shpnt)->data_len) diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h index 8e420add7daa1..f4782284807a5 100644 --- a/include/asm-i386/floppy.h +++ b/include/asm-i386/floppy.h @@ -204,7 +204,7 @@ static unsigned long vdma_mem_alloc(unsigned long size) static void _fd_dma_mem_free(unsigned long addr, unsigned long size) { if((unsigned int) addr >= (unsigned int) high_memory) - return vfree((void *)addr); + vfree((void *)addr); else free_pages(addr, get_order(size)); } -- 2.53.0