From 3f85e843c1b7c30a3767a26b9328dec492012b1c Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Thu, 3 Jun 2004 02:47:51 -0700 Subject: [PATCH] [PATCH] sparse: sound/core annotation - trivial part Trivial parts of sound/core annotation. --- include/sound/core.h | 4 +-- sound/core/control.c | 56 ++++++++++++++++-------------- sound/core/hwdep.c | 25 ++++++------- sound/core/info.c | 4 +-- sound/core/memory.c | 4 +-- sound/core/pcm.c | 9 ++--- sound/core/rawmidi.c | 32 +++++++++-------- sound/core/seq/oss/seq_oss.c | 8 ++--- sound/core/seq/oss/seq_oss_ioctl.c | 27 +++++++------- sound/core/timer.c | 40 +++++++++++---------- 10 files changed, 109 insertions(+), 100 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index 5d609309aaec8..caf1b3c859d3f 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -302,8 +302,8 @@ void snd_hidden_vfree(void *obj); #endif void *snd_kcalloc(size_t size, int flags); char *snd_kmalloc_strdup(const char *string, int flags); -int copy_to_user_fromio(void *dst, unsigned long src, size_t count); -int copy_from_user_toio(unsigned long dst, const void *src, size_t count); +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count); +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count); /* init.c */ diff --git a/sound/core/control.c b/sound/core/control.c index 95e84dfe18597..7cc19394dae89 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -512,7 +512,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) } static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, - unsigned int cmd, unsigned long arg) + unsigned int cmd, void __user *arg) { snd_ctl_card_info_t info; @@ -526,12 +526,12 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, strlcpy(info.mixername, card->mixername, sizeof(info.mixername)); strlcpy(info.components, card->components, sizeof(info.components)); up_read(&snd_ioctl_rwsem); - if (copy_to_user((void *) arg, &info, sizeof(snd_ctl_card_info_t))) + if (copy_to_user(arg, &info, sizeof(snd_ctl_card_info_t))) return -EFAULT; return 0; } -static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list) +static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list) { struct list_head *plist; snd_ctl_elem_list_t list; @@ -593,7 +593,7 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list) return 0; } -static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info) +static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __user *_info) { snd_card_t *card = ctl->card; snd_ctl_elem_info_t info; @@ -636,7 +636,7 @@ static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info) return result; } -static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t __user *_control) { snd_ctl_elem_value_t *control; snd_kcontrol_t *kctl; @@ -676,7 +676,7 @@ static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) return result; } -static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t __user *_control) { snd_card_t *card = file->card; snd_ctl_elem_value_t *control; @@ -726,7 +726,7 @@ static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_contr return result; } -static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -754,7 +754,7 @@ static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) return result; } -static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -840,7 +840,7 @@ static void snd_ctl_elem_user_free(snd_kcontrol_t * kcontrol) kfree(kcontrol->private_data); } -static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, int replace) +static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t __user *_info, int replace) { snd_card_t *card = file->card; snd_ctl_elem_info_t info; @@ -965,7 +965,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, in return 0; } -static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_ctl_elem_id_t id; @@ -974,7 +974,7 @@ static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) return snd_ctl_remove_unlocked_id(file, &id); } -static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int *ptr) +static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr) { int subscribe; if (get_user(subscribe, ptr)) @@ -1029,6 +1029,8 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, snd_card_t *card; struct list_head *list; snd_kctl_ioctl_t *p; + void __user *argp = (void __user *)arg; + int __user *ip = argp; int err; ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO); @@ -1036,31 +1038,31 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, snd_assert(card != NULL, return -ENXIO); switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: - return put_user(SNDRV_CTL_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0; case SNDRV_CTL_IOCTL_CARD_INFO: - return snd_ctl_card_info(card, ctl, cmd, arg); + return snd_ctl_card_info(card, ctl, cmd, argp); case SNDRV_CTL_IOCTL_ELEM_LIST: - return snd_ctl_elem_list(ctl->card, (snd_ctl_elem_list_t *) arg); + return snd_ctl_elem_list(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_INFO: - return snd_ctl_elem_info(ctl, (snd_ctl_elem_info_t *) arg); + return snd_ctl_elem_info(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_READ: - return snd_ctl_elem_read(ctl->card, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_read(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_WRITE: - return snd_ctl_elem_write(ctl, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_write(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_LOCK: - return snd_ctl_elem_lock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_lock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_UNLOCK: - return snd_ctl_elem_unlock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_unlock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_ADD: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 0); + return snd_ctl_elem_add(ctl, argp, 0); case SNDRV_CTL_IOCTL_ELEM_REPLACE: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 1); + return snd_ctl_elem_add(ctl, argp, 1); case SNDRV_CTL_IOCTL_ELEM_REMOVE: - return snd_ctl_elem_remove(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_remove(ctl, argp); case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: - return snd_ctl_subscribe_events(ctl, (int *) arg); + return snd_ctl_subscribe_events(ctl, ip); case SNDRV_CTL_IOCTL_POWER: - if (get_user(err, (int *)arg)) + if (get_user(err, ip)) return -EFAULT; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1075,9 +1077,9 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, return err; case SNDRV_CTL_IOCTL_POWER_STATE: #ifdef CONFIG_PM - return put_user(card->power_state, (int *)arg) ? -EFAULT : 0; + return put_user(card->power_state, ip) ? -EFAULT : 0; #else - return put_user(SNDRV_CTL_POWER_D0, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_POWER_D0, ip) ? -EFAULT : 0; #endif } down_read(&snd_ioctl_rwsem); @@ -1094,7 +1096,7 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, return -ENOTTY; } -static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_t * offset) +static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_ctl_file_t *ctl; int err = 0; diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 33d7603f90605..d18e4769d1aa1 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -55,7 +55,7 @@ static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig) return -ENXIO; } -static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_read(struct file * file, char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.read) @@ -63,7 +63,7 @@ static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_ return -ENXIO; } -static ssize_t snd_hwdep_write(struct file * file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.write) @@ -179,7 +179,7 @@ static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait) return 0; } -static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info) +static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info) { snd_hwdep_info_t info; @@ -193,7 +193,7 @@ static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info) return 0; } -static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) +static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *_info) { snd_hwdep_dsp_status_t info; int err; @@ -209,7 +209,7 @@ static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) return 0; } -static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *_info) +static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_info) { snd_hwdep_dsp_image_t info; int err; @@ -235,15 +235,16 @@ static int snd_hwdep_ioctl(struct inode *inode, struct file * file, unsigned int cmd, unsigned long arg) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); + void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HWDEP_IOCTL_PVERSION: - return put_user(SNDRV_HWDEP_VERSION, (int *)arg); + return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp); case SNDRV_HWDEP_IOCTL_INFO: - return snd_hwdep_info(hw, (snd_hwdep_info_t *)arg); + return snd_hwdep_info(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_STATUS: - return snd_hwdep_dsp_status(hw, (snd_hwdep_dsp_status_t *)arg); + return snd_hwdep_dsp_status(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_LOAD: - return snd_hwdep_dsp_load(hw, (snd_hwdep_dsp_image_t *)arg); + return snd_hwdep_dsp_load(hw, argp); } if (hw->ops.ioctl) return hw->ops.ioctl(hw, file, cmd, arg); @@ -269,7 +270,7 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_MINOR_HWDEPS) { @@ -279,13 +280,13 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, } if (device >= SNDRV_MINOR_HWDEPS) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_HWDEP_INFO: { - snd_hwdep_info_t *info = (snd_hwdep_info_t *)arg; + snd_hwdep_info_t __user *info = (snd_hwdep_info_t __user *)arg; int device; snd_hwdep_t *hwdep; diff --git a/sound/core/info.c b/sound/core/info.c index fadd47112e65e..0b08203d50e5a 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -174,7 +174,7 @@ out: return ret; } -static ssize_t snd_info_entry_read(struct file *file, char *buffer, +static ssize_t snd_info_entry_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; @@ -208,7 +208,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer, return size; } -static ssize_t snd_info_entry_write(struct file *file, const char *buffer, +static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; diff --git a/sound/core/memory.c b/sound/core/memory.c index 1f8c8d93409d3..cf4f75cec298a 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -307,7 +307,7 @@ char *snd_kmalloc_strdup(const char *string, int flags) * * Returns zero if successful, or non-zero on failure. */ -int copy_to_user_fromio(void *dst, unsigned long src, size_t count) +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; @@ -338,7 +338,7 @@ int copy_to_user_fromio(void *dst, unsigned long src, size_t count) * * Returns zero if successful, or non-zero on failure. */ -int copy_from_user_toio(unsigned long dst, const void *src, size_t count) +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 4f879747d1db9..7f1bf94e0e4cd 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -55,7 +55,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_PCM_DEVICES) { @@ -65,18 +65,19 @@ static int snd_pcm_control_ioctl(snd_card_t * card, } if (device == SNDRV_PCM_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_PCM_INFO: { - snd_pcm_info_t *info = (snd_pcm_info_t *)arg; + snd_pcm_info_t __user *info; unsigned int device, subdevice; snd_pcm_stream_t stream; snd_pcm_t *pcm; snd_pcm_str_t *pstr; snd_pcm_substream_t *substream; + info = (snd_pcm_info_t __user *)arg; if (get_user(device, &info->device)) return -EFAULT; if (device >= SNDRV_PCM_DEVICES) @@ -106,7 +107,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; control->prefer_pcm_subdevice = val; return 0; diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index abc2221d7c9e0..df904d18d6cf4 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -543,7 +543,7 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf return 0; } -static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t * _info) +static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info) { snd_rawmidi_info_t info; int err; @@ -579,7 +579,7 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) } static int snd_rawmidi_info_select_user(snd_card_t *card, - snd_rawmidi_info_t *_info) + snd_rawmidi_info_t __user *_info) { int err; snd_rawmidi_info_t info; @@ -679,17 +679,18 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { snd_rawmidi_file_t *rfile; + void __user *argp = (void __user *)arg; rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO); if (((cmd >> 8) & 0xff) != 'W') return -ENOTTY; switch (cmd) { case SNDRV_RAWMIDI_IOCTL_PVERSION: - return put_user(SNDRV_RAWMIDI_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0; case SNDRV_RAWMIDI_IOCTL_INFO: { snd_rawmidi_stream_t stream; - snd_rawmidi_info_t *info = (snd_rawmidi_info_t *) arg; + snd_rawmidi_info_t __user *info = argp; if (get_user(stream, &info->stream)) return -EFAULT; switch (stream) { @@ -704,7 +705,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, case SNDRV_RAWMIDI_IOCTL_PARAMS: { snd_rawmidi_params_t params; - if (copy_from_user(¶ms, (snd_rawmidi_params_t *) arg, sizeof(snd_rawmidi_params_t))) + if (copy_from_user(¶ms, argp, sizeof(snd_rawmidi_params_t))) return -EFAULT; switch (params.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -723,7 +724,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, { int err = 0; snd_rawmidi_status_t status; - if (copy_from_user(&status, (snd_rawmidi_status_t *) arg, sizeof(snd_rawmidi_status_t))) + if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t))) return -EFAULT; switch (status.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -741,14 +742,14 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, } if (err < 0) return err; - if (copy_to_user((snd_rawmidi_status_t *) arg, &status, sizeof(snd_rawmidi_status_t))) + if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t))) return -EFAULT; return 0; } case SNDRV_RAWMIDI_IOCTL_DROP: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -762,7 +763,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, case SNDRV_RAWMIDI_IOCTL_DRAIN: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -788,6 +789,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; unsigned int tmp; tmp = card->number * SNDRV_RAWMIDI_DEVICES; @@ -796,7 +798,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)argp)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_RAWMIDI_DEVICES) { @@ -806,7 +808,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, } if (device == SNDRV_RAWMIDI_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)argp)) return -EFAULT; return 0; } @@ -814,13 +816,13 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; control->prefer_rawmidi_subdevice = val; return 0; } case SNDRV_CTL_IOCTL_RAWMIDI_INFO: - return snd_rawmidi_info_select_user(card, (snd_rawmidi_info_t *)arg); + return snd_rawmidi_info_select_user(card, argp); } return -ENOIOCTLCMD; } @@ -934,7 +936,7 @@ long snd_rawmidi_kernel_read(snd_rawmidi_substream_t *substream, unsigned char * return snd_rawmidi_kernel_read1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { long result; int count1; @@ -1166,7 +1168,7 @@ long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigne return snd_rawmidi_kernel_write1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { long result, timeout; int count1; diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 50a3740bf2208..5681563fa05d1 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -57,8 +57,8 @@ static void unregister_proc(void); static int odev_open(struct inode *inode, struct file *file); static int odev_release(struct inode *inode, struct file *file); -static ssize_t odev_read(struct file *file, char *buf, size_t count, loff_t *offset); -static ssize_t odev_write(struct file *file, const char *buf, size_t count, loff_t *offset); +static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset); +static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static unsigned int odev_poll(struct file *file, poll_table * wait); #ifdef CONFIG_PROC_FS @@ -155,7 +155,7 @@ odev_release(struct inode *inode, struct file *file) } static ssize_t -odev_read(struct file *file, char *buf, size_t count, loff_t *offset) +odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; @@ -165,7 +165,7 @@ odev_read(struct file *file, char *buf, size_t count, loff_t *offset) static ssize_t -odev_write(struct file *file, const char *buf, size_t count, loff_t *offset) +odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c index d5973a8370faf..6d783cd141c9d 100644 --- a/sound/core/seq/oss/seq_oss_ioctl.c +++ b/sound/core/seq/oss/seq_oss_ioctl.c @@ -36,6 +36,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) struct midi_info minf; unsigned char ev[8]; void __user *arg = (void __user *)carg; + int __user *p = arg; snd_seq_event_t tmpev; switch (cmd) { @@ -72,7 +73,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) case SNDCTL_SEQ_TESTMIDI: debug_printk(("test midi\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_midi_open(dp, dev, dp->file_mode); @@ -80,42 +81,42 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("get in count\n")); if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) return 0; - return put_user(dp->readq->qlen, (int *)arg) ? -EFAULT : 0; + return put_user(dp->readq->qlen, p) ? -EFAULT : 0; case SNDCTL_SEQ_GETOUTCOUNT: debug_printk(("get out count\n")); if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) return 0; - return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0; case SNDCTL_SEQ_GETTIME: debug_printk(("get time\n")); - return put_user(snd_seq_oss_timer_cur_tick(dp->timer), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0; case SNDCTL_SEQ_RESETSAMPLES: debug_printk(("reset samples\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); case SNDCTL_SEQ_NRSYNTHS: debug_printk(("nr synths\n")); - return put_user(dp->max_synthdev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_synthdev, p) ? -EFAULT : 0; case SNDCTL_SEQ_NRMIDIS: debug_printk(("nr midis\n")); - return put_user(dp->max_mididev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_mididev, p) ? -EFAULT : 0; case SNDCTL_SYNTH_MEMAVL: debug_printk(("mem avail\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; case SNDCTL_FM_4OP_ENABLE: debug_printk(("4op\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); return 0; @@ -157,7 +158,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("threshold\n")); if (! is_write_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 1) val = 1; @@ -170,14 +171,14 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("pretime\n")); if (dp->readq == NULL || !is_read_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val <= 0) val = -1; else val = (HZ * val) / 10; dp->readq->pre_event_timeout = val; - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; default: debug_printk(("others\n")); diff --git a/sound/core/timer.c b/sound/core/timer.c index 1f23781d2bdcd..6f6d89c431cd2 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1253,7 +1253,7 @@ static void snd_timer_user_copy_id(snd_timer_id_t *id, snd_timer_t *timer) id->subdevice = timer->tmr_subdevice; } -static int snd_timer_user_next_device(snd_timer_id_t *_tid) +static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) { snd_timer_id_t id; snd_timer_t *timer; @@ -1344,7 +1344,7 @@ static int snd_timer_user_next_device(snd_timer_id_t *_tid) return 0; } -static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) +static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_ginfo) { snd_timer_ginfo_t ginfo; snd_timer_id_t tid; @@ -1382,7 +1382,7 @@ static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) return err; } -static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gparams) +static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user *_gparams) { snd_timer_gparams_t gparams; snd_timer_t *t; @@ -1408,7 +1408,7 @@ static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gpara return err; } -static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstatus) +static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user *_gstatus) { snd_timer_gstatus_t gstatus; snd_timer_id_t tid; @@ -1442,7 +1442,7 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat return err; } -static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselect) +static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *_tselect) { snd_timer_user_t *tu; snd_timer_select_t tselect; @@ -1489,7 +1489,7 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselec return 0; } -static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info) +static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info) { snd_timer_user_t *tu; snd_timer_info_t info; @@ -1511,7 +1511,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info) return 0; } -static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params) +static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_params) { snd_timer_user_t *tu; snd_timer_params_t params; @@ -1603,7 +1603,7 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params) return err; } -static int snd_timer_user_status(struct file *file, snd_timer_status_t *_status) +static int snd_timer_user_status(struct file *file, snd_timer_status_t __user *_status) { snd_timer_user_t *tu; snd_timer_status_t status; @@ -1661,38 +1661,40 @@ static int snd_timer_user_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { snd_timer_user_t *tu; + void __user *argp = (void __user *)arg; + int __user *p = argp; tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO); switch (cmd) { case SNDRV_TIMER_IOCTL_PVERSION: - return put_user(SNDRV_TIMER_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0; case SNDRV_TIMER_IOCTL_NEXT_DEVICE: - return snd_timer_user_next_device((snd_timer_id_t *)arg); + return snd_timer_user_next_device(argp); case SNDRV_TIMER_IOCTL_TREAD: { int xarg; if (tu->timeri) /* too late */ return -EBUSY; - if (get_user(xarg, (int *) arg)) + if (get_user(xarg, p)) return -EFAULT; tu->tread = xarg ? 1 : 0; return 0; } case SNDRV_TIMER_IOCTL_GINFO: - return snd_timer_user_ginfo(file, (snd_timer_ginfo_t *)arg); + return snd_timer_user_ginfo(file, argp); case SNDRV_TIMER_IOCTL_GPARAMS: - return snd_timer_user_gparams(file, (snd_timer_gparams_t *)arg); + return snd_timer_user_gparams(file, argp); case SNDRV_TIMER_IOCTL_GSTATUS: - return snd_timer_user_gstatus(file, (snd_timer_gstatus_t *)arg); + return snd_timer_user_gstatus(file, argp); case SNDRV_TIMER_IOCTL_SELECT: - return snd_timer_user_tselect(file, (snd_timer_select_t *)arg); + return snd_timer_user_tselect(file, argp); case SNDRV_TIMER_IOCTL_INFO: - return snd_timer_user_info(file, (snd_timer_info_t *)arg); + return snd_timer_user_info(file, argp); case SNDRV_TIMER_IOCTL_PARAMS: - return snd_timer_user_params(file, (snd_timer_params_t *)arg); + return snd_timer_user_params(file, argp); case SNDRV_TIMER_IOCTL_STATUS: - return snd_timer_user_status(file, (snd_timer_status_t *)arg); + return snd_timer_user_status(file, argp); case SNDRV_TIMER_IOCTL_START: return snd_timer_user_start(file); case SNDRV_TIMER_IOCTL_STOP: @@ -1715,7 +1717,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on) return 0; } -static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count, loff_t *offset) +static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) { snd_timer_user_t *tu; long result = 0, unit; -- 2.53.0