Commit 3f85e843 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: sound/core annotation - trivial part

Trivial parts of sound/core annotation.
parent e954b6f6
...@@ -302,8 +302,8 @@ void snd_hidden_vfree(void *obj); ...@@ -302,8 +302,8 @@ void snd_hidden_vfree(void *obj);
#endif #endif
void *snd_kcalloc(size_t size, int flags); void *snd_kcalloc(size_t size, int flags);
char *snd_kmalloc_strdup(const char *string, 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_to_user_fromio(void __user *dst, unsigned long src, size_t count);
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);
/* init.c */ /* init.c */
......
...@@ -512,7 +512,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) ...@@ -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, 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; 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, ...@@ -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.mixername, card->mixername, sizeof(info.mixername));
strlcpy(info.components, card->components, sizeof(info.components)); strlcpy(info.components, card->components, sizeof(info.components));
up_read(&snd_ioctl_rwsem); 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 -EFAULT;
return 0; 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; struct list_head *plist;
snd_ctl_elem_list_t list; 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) ...@@ -593,7 +593,7 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list)
return 0; 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_card_t *card = ctl->card;
snd_ctl_elem_info_t info; 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) ...@@ -636,7 +636,7 @@ static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info)
return result; 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_ctl_elem_value_t *control;
snd_kcontrol_t *kctl; snd_kcontrol_t *kctl;
...@@ -676,7 +676,7 @@ static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) ...@@ -676,7 +676,7 @@ static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control)
return result; 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_card_t *card = file->card;
snd_ctl_elem_value_t *control; 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 ...@@ -726,7 +726,7 @@ static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_contr
return result; 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_card_t *card = file->card;
snd_ctl_elem_id_t id; 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) ...@@ -754,7 +754,7 @@ static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id)
return result; 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_card_t *card = file->card;
snd_ctl_elem_id_t id; snd_ctl_elem_id_t id;
...@@ -840,7 +840,7 @@ static void snd_ctl_elem_user_free(snd_kcontrol_t * kcontrol) ...@@ -840,7 +840,7 @@ static void snd_ctl_elem_user_free(snd_kcontrol_t * kcontrol)
kfree(kcontrol->private_data); 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_card_t *card = file->card;
snd_ctl_elem_info_t info; 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 ...@@ -965,7 +965,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, in
return 0; 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; 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) ...@@ -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); 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; int subscribe;
if (get_user(subscribe, ptr)) if (get_user(subscribe, ptr))
...@@ -1029,6 +1029,8 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, ...@@ -1029,6 +1029,8 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file,
snd_card_t *card; snd_card_t *card;
struct list_head *list; struct list_head *list;
snd_kctl_ioctl_t *p; snd_kctl_ioctl_t *p;
void __user *argp = (void __user *)arg;
int __user *ip = argp;
int err; int err;
ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO); 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, ...@@ -1036,31 +1038,31 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file,
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
switch (cmd) { switch (cmd) {
case SNDRV_CTL_IOCTL_PVERSION: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: case SNDRV_CTL_IOCTL_POWER:
if (get_user(err, (int *)arg)) if (get_user(err, ip))
return -EFAULT; return -EFAULT;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
...@@ -1075,9 +1077,9 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, ...@@ -1075,9 +1077,9 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file,
return err; return err;
case SNDRV_CTL_IOCTL_POWER_STATE: case SNDRV_CTL_IOCTL_POWER_STATE:
#ifdef CONFIG_PM #ifdef CONFIG_PM
return put_user(card->power_state, (int *)arg) ? -EFAULT : 0; return put_user(card->power_state, ip) ? -EFAULT : 0;
#else #else
return put_user(SNDRV_CTL_POWER_D0, (int *)arg) ? -EFAULT : 0; return put_user(SNDRV_CTL_POWER_D0, ip) ? -EFAULT : 0;
#endif #endif
} }
down_read(&snd_ioctl_rwsem); down_read(&snd_ioctl_rwsem);
...@@ -1094,7 +1096,7 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, ...@@ -1094,7 +1096,7 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file,
return -ENOTTY; 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; snd_ctl_file_t *ctl;
int err = 0; int err = 0;
......
...@@ -55,7 +55,7 @@ static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig) ...@@ -55,7 +55,7 @@ static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig)
return -ENXIO; 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); snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
if (hw->ops.read) if (hw->ops.read)
...@@ -63,7 +63,7 @@ static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_ ...@@ -63,7 +63,7 @@ static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_
return -ENXIO; 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); snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
if (hw->ops.write) if (hw->ops.write)
...@@ -179,7 +179,7 @@ static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait) ...@@ -179,7 +179,7 @@ static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait)
return 0; 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; snd_hwdep_info_t info;
...@@ -193,7 +193,7 @@ static int snd_hwdep_info(snd_hwdep_t *hw, 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; 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; snd_hwdep_dsp_status_t info;
int err; int err;
...@@ -209,7 +209,7 @@ static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) ...@@ -209,7 +209,7 @@ static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info)
return 0; 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; snd_hwdep_dsp_image_t info;
int err; int err;
...@@ -235,15 +235,16 @@ static int snd_hwdep_ioctl(struct inode *inode, struct file * file, ...@@ -235,15 +235,16 @@ static int snd_hwdep_ioctl(struct inode *inode, struct file * file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
void __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case SNDRV_HWDEP_IOCTL_PVERSION: 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: 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: 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: 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) if (hw->ops.ioctl)
return hw->ops.ioctl(hw, file, cmd, arg); 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, ...@@ -269,7 +270,7 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
{ {
int device; int device;
if (get_user(device, (int *)arg)) if (get_user(device, (int __user *)arg))
return -EFAULT; return -EFAULT;
device = device < 0 ? 0 : device + 1; device = device < 0 ? 0 : device + 1;
while (device < SNDRV_MINOR_HWDEPS) { while (device < SNDRV_MINOR_HWDEPS) {
...@@ -279,13 +280,13 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, ...@@ -279,13 +280,13 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
} }
if (device >= SNDRV_MINOR_HWDEPS) if (device >= SNDRV_MINOR_HWDEPS)
device = -1; device = -1;
if (put_user(device, (int *)arg)) if (put_user(device, (int __user *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
case SNDRV_CTL_IOCTL_HWDEP_INFO: 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; int device;
snd_hwdep_t *hwdep; snd_hwdep_t *hwdep;
......
...@@ -174,7 +174,7 @@ static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig) ...@@ -174,7 +174,7 @@ static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig)
return ret; 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) size_t count, loff_t * offset)
{ {
snd_info_private_data_t *data; snd_info_private_data_t *data;
...@@ -208,7 +208,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer, ...@@ -208,7 +208,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer,
return size; 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) size_t count, loff_t * offset)
{ {
snd_info_private_data_t *data; snd_info_private_data_t *data;
......
...@@ -307,7 +307,7 @@ char *snd_kmalloc_strdup(const char *string, int flags) ...@@ -307,7 +307,7 @@ char *snd_kmalloc_strdup(const char *string, int flags)
* *
* Returns zero if successful, or non-zero on failure. * 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) #if defined(__i386__) || defined(CONFIG_SPARC32)
return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; 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) ...@@ -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. * 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) #if defined(__i386__) || defined(CONFIG_SPARC32)
return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; return copy_from_user((void*)dst, src, count) ? -EFAULT : 0;
......
...@@ -55,7 +55,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, ...@@ -55,7 +55,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
{ {
int device; int device;
if (get_user(device, (int *)arg)) if (get_user(device, (int __user *)arg))
return -EFAULT; return -EFAULT;
device = device < 0 ? 0 : device + 1; device = device < 0 ? 0 : device + 1;
while (device < SNDRV_PCM_DEVICES) { while (device < SNDRV_PCM_DEVICES) {
...@@ -65,18 +65,19 @@ static int snd_pcm_control_ioctl(snd_card_t * card, ...@@ -65,18 +65,19 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
} }
if (device == SNDRV_PCM_DEVICES) if (device == SNDRV_PCM_DEVICES)
device = -1; device = -1;
if (put_user(device, (int *)arg)) if (put_user(device, (int __user *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
case SNDRV_CTL_IOCTL_PCM_INFO: 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; unsigned int device, subdevice;
snd_pcm_stream_t stream; snd_pcm_stream_t stream;
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_str_t *pstr; snd_pcm_str_t *pstr;
snd_pcm_substream_t *substream; snd_pcm_substream_t *substream;
info = (snd_pcm_info_t __user *)arg;
if (get_user(device, &info->device)) if (get_user(device, &info->device))
return -EFAULT; return -EFAULT;
if (device >= SNDRV_PCM_DEVICES) if (device >= SNDRV_PCM_DEVICES)
...@@ -106,7 +107,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, ...@@ -106,7 +107,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
{ {
int val; int val;
if (get_user(val, (int *)arg)) if (get_user(val, (int __user *)arg))
return -EFAULT; return -EFAULT;
control->prefer_pcm_subdevice = val; control->prefer_pcm_subdevice = val;
return 0; return 0;
......
...@@ -543,7 +543,7 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf ...@@ -543,7 +543,7 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf
return 0; 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; snd_rawmidi_info_t info;
int err; int err;
...@@ -579,7 +579,7 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) ...@@ -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, static int snd_rawmidi_info_select_user(snd_card_t *card,
snd_rawmidi_info_t *_info) snd_rawmidi_info_t __user *_info)
{ {
int err; int err;
snd_rawmidi_info_t info; snd_rawmidi_info_t info;
...@@ -679,17 +679,18 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -679,17 +679,18 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
snd_rawmidi_file_t *rfile; snd_rawmidi_file_t *rfile;
void __user *argp = (void __user *)arg;
rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO); rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO);
if (((cmd >> 8) & 0xff) != 'W') if (((cmd >> 8) & 0xff) != 'W')
return -ENOTTY; return -ENOTTY;
switch (cmd) { switch (cmd) {
case SNDRV_RAWMIDI_IOCTL_PVERSION: 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: case SNDRV_RAWMIDI_IOCTL_INFO:
{ {
snd_rawmidi_stream_t stream; 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)) if (get_user(stream, &info->stream))
return -EFAULT; return -EFAULT;
switch (stream) { switch (stream) {
...@@ -704,7 +705,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -704,7 +705,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file,
case SNDRV_RAWMIDI_IOCTL_PARAMS: case SNDRV_RAWMIDI_IOCTL_PARAMS:
{ {
snd_rawmidi_params_t params; snd_rawmidi_params_t params;
if (copy_from_user(&params, (snd_rawmidi_params_t *) arg, sizeof(snd_rawmidi_params_t))) if (copy_from_user(&params, argp, sizeof(snd_rawmidi_params_t)))
return -EFAULT; return -EFAULT;
switch (params.stream) { switch (params.stream) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -723,7 +724,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -723,7 +724,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file,
{ {
int err = 0; int err = 0;
snd_rawmidi_status_t status; 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; return -EFAULT;
switch (status.stream) { switch (status.stream) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -741,14 +742,14 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -741,14 +742,14 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file,
} }
if (err < 0) if (err < 0)
return err; 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 -EFAULT;
return 0; return 0;
} }
case SNDRV_RAWMIDI_IOCTL_DROP: case SNDRV_RAWMIDI_IOCTL_DROP:
{ {
int val; int val;
if (get_user(val, (long *) arg)) if (get_user(val, (long __user *) argp))
return -EFAULT; return -EFAULT;
switch (val) { switch (val) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -762,7 +763,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -762,7 +763,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file,
case SNDRV_RAWMIDI_IOCTL_DRAIN: case SNDRV_RAWMIDI_IOCTL_DRAIN:
{ {
int val; int val;
if (get_user(val, (long *) arg)) if (get_user(val, (long __user *) argp))
return -EFAULT; return -EFAULT;
switch (val) { switch (val) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -788,6 +789,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, ...@@ -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, int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
unsigned int tmp; unsigned int tmp;
tmp = card->number * SNDRV_RAWMIDI_DEVICES; tmp = card->number * SNDRV_RAWMIDI_DEVICES;
...@@ -796,7 +798,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, ...@@ -796,7 +798,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
{ {
int device; int device;
if (get_user(device, (int *)arg)) if (get_user(device, (int __user *)argp))
return -EFAULT; return -EFAULT;
device = device < 0 ? 0 : device + 1; device = device < 0 ? 0 : device + 1;
while (device < SNDRV_RAWMIDI_DEVICES) { while (device < SNDRV_RAWMIDI_DEVICES) {
...@@ -806,7 +808,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, ...@@ -806,7 +808,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
} }
if (device == SNDRV_RAWMIDI_DEVICES) if (device == SNDRV_RAWMIDI_DEVICES)
device = -1; device = -1;
if (put_user(device, (int *)arg)) if (put_user(device, (int __user *)argp))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -814,13 +816,13 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, ...@@ -814,13 +816,13 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
{ {
int val; int val;
if (get_user(val, (int *)arg)) if (get_user(val, (int __user *)argp))
return -EFAULT; return -EFAULT;
control->prefer_rawmidi_subdevice = val; control->prefer_rawmidi_subdevice = val;
return 0; return 0;
} }
case SNDRV_CTL_IOCTL_RAWMIDI_INFO: 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; return -ENOIOCTLCMD;
} }
...@@ -934,7 +936,7 @@ long snd_rawmidi_kernel_read(snd_rawmidi_substream_t *substream, unsigned char * ...@@ -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); 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; long result;
int count1; int count1;
...@@ -1166,7 +1168,7 @@ long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigne ...@@ -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); 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; long result, timeout;
int count1; int count1;
......
...@@ -57,8 +57,8 @@ static void unregister_proc(void); ...@@ -57,8 +57,8 @@ static void unregister_proc(void);
static int odev_open(struct inode *inode, struct file *file); static int odev_open(struct inode *inode, struct file *file);
static int odev_release(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_read(struct file *file, char __user *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_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 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); static unsigned int odev_poll(struct file *file, poll_table * wait);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -155,7 +155,7 @@ odev_release(struct inode *inode, struct file *file) ...@@ -155,7 +155,7 @@ odev_release(struct inode *inode, struct file *file)
} }
static ssize_t 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; seq_oss_devinfo_t *dp;
dp = file->private_data; dp = file->private_data;
...@@ -165,7 +165,7 @@ odev_read(struct file *file, char *buf, size_t count, loff_t *offset) ...@@ -165,7 +165,7 @@ odev_read(struct file *file, char *buf, size_t count, loff_t *offset)
static ssize_t 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; seq_oss_devinfo_t *dp;
dp = file->private_data; dp = file->private_data;
......
...@@ -36,6 +36,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) ...@@ -36,6 +36,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
struct midi_info minf; struct midi_info minf;
unsigned char ev[8]; unsigned char ev[8];
void __user *arg = (void __user *)carg; void __user *arg = (void __user *)carg;
int __user *p = arg;
snd_seq_event_t tmpev; snd_seq_event_t tmpev;
switch (cmd) { switch (cmd) {
...@@ -72,7 +73,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) ...@@ -72,7 +73,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
case SNDCTL_SEQ_TESTMIDI: case SNDCTL_SEQ_TESTMIDI:
debug_printk(("test midi\n")); debug_printk(("test midi\n"));
if (get_user(dev, (int *)arg)) if (get_user(dev, p))
return -EFAULT; return -EFAULT;
return snd_seq_oss_midi_open(dp, dev, dp->file_mode); 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) ...@@ -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")); debug_printk(("get in count\n"));
if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) if (dp->readq == NULL || ! is_read_mode(dp->file_mode))
return 0; 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: case SNDCTL_SEQ_GETOUTCOUNT:
debug_printk(("get out count\n")); debug_printk(("get out count\n"));
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
return 0; 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: case SNDCTL_SEQ_GETTIME:
debug_printk(("get time\n")); 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: case SNDCTL_SEQ_RESETSAMPLES:
debug_printk(("reset samples\n")); debug_printk(("reset samples\n"));
if (get_user(dev, (int *)arg)) if (get_user(dev, p))
return -EFAULT; return -EFAULT;
return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
case SNDCTL_SEQ_NRSYNTHS: case SNDCTL_SEQ_NRSYNTHS:
debug_printk(("nr synths\n")); 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: case SNDCTL_SEQ_NRMIDIS:
debug_printk(("nr midis\n")); 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: case SNDCTL_SYNTH_MEMAVL:
debug_printk(("mem avail\n")); debug_printk(("mem avail\n"));
if (get_user(dev, (int *)arg)) if (get_user(dev, p))
return -EFAULT; return -EFAULT;
val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); 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: case SNDCTL_FM_4OP_ENABLE:
debug_printk(("4op\n")); debug_printk(("4op\n"));
if (get_user(dev, (int *)arg)) if (get_user(dev, p))
return -EFAULT; return -EFAULT;
snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
return 0; return 0;
...@@ -157,7 +158,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) ...@@ -157,7 +158,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
debug_printk(("threshold\n")); debug_printk(("threshold\n"));
if (! is_write_mode(dp->file_mode)) if (! is_write_mode(dp->file_mode))
return 0; return 0;
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val < 1) if (val < 1)
val = 1; val = 1;
...@@ -170,14 +171,14 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) ...@@ -170,14 +171,14 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
debug_printk(("pretime\n")); debug_printk(("pretime\n"));
if (dp->readq == NULL || !is_read_mode(dp->file_mode)) if (dp->readq == NULL || !is_read_mode(dp->file_mode))
return 0; return 0;
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val <= 0) if (val <= 0)
val = -1; val = -1;
else else
val = (HZ * val) / 10; val = (HZ * val) / 10;
dp->readq->pre_event_timeout = val; dp->readq->pre_event_timeout = val;
return put_user(val, (int *)arg) ? -EFAULT : 0; return put_user(val, p) ? -EFAULT : 0;
default: default:
debug_printk(("others\n")); debug_printk(("others\n"));
......
...@@ -1253,7 +1253,7 @@ static void snd_timer_user_copy_id(snd_timer_id_t *id, snd_timer_t *timer) ...@@ -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; 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_id_t id;
snd_timer_t *timer; snd_timer_t *timer;
...@@ -1344,7 +1344,7 @@ static int snd_timer_user_next_device(snd_timer_id_t *_tid) ...@@ -1344,7 +1344,7 @@ static int snd_timer_user_next_device(snd_timer_id_t *_tid)
return 0; 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_ginfo_t ginfo;
snd_timer_id_t tid; snd_timer_id_t tid;
...@@ -1382,7 +1382,7 @@ static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) ...@@ -1382,7 +1382,7 @@ static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo)
return err; 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_gparams_t gparams;
snd_timer_t *t; snd_timer_t *t;
...@@ -1408,7 +1408,7 @@ static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gpara ...@@ -1408,7 +1408,7 @@ static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gpara
return err; 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_gstatus_t gstatus;
snd_timer_id_t tid; snd_timer_id_t tid;
...@@ -1442,7 +1442,7 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat ...@@ -1442,7 +1442,7 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat
return err; 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_user_t *tu;
snd_timer_select_t tselect; snd_timer_select_t tselect;
...@@ -1489,7 +1489,7 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselec ...@@ -1489,7 +1489,7 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselec
return 0; 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_user_t *tu;
snd_timer_info_t info; snd_timer_info_t info;
...@@ -1511,7 +1511,7 @@ static int snd_timer_user_info(struct file *file, 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; 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_user_t *tu;
snd_timer_params_t params; snd_timer_params_t params;
...@@ -1603,7 +1603,7 @@ static int snd_timer_user_params(struct file *file, 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; 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_user_t *tu;
snd_timer_status_t status; snd_timer_status_t status;
...@@ -1661,38 +1661,40 @@ static int snd_timer_user_ioctl(struct inode *inode, struct file *file, ...@@ -1661,38 +1661,40 @@ static int snd_timer_user_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
snd_timer_user_t *tu; 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); tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO);
switch (cmd) { switch (cmd) {
case SNDRV_TIMER_IOCTL_PVERSION: 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: 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: case SNDRV_TIMER_IOCTL_TREAD:
{ {
int xarg; int xarg;
if (tu->timeri) /* too late */ if (tu->timeri) /* too late */
return -EBUSY; return -EBUSY;
if (get_user(xarg, (int *) arg)) if (get_user(xarg, p))
return -EFAULT; return -EFAULT;
tu->tread = xarg ? 1 : 0; tu->tread = xarg ? 1 : 0;
return 0; return 0;
} }
case SNDRV_TIMER_IOCTL_GINFO: 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: 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: 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: 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: 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: 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: 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: case SNDRV_TIMER_IOCTL_START:
return snd_timer_user_start(file); return snd_timer_user_start(file);
case SNDRV_TIMER_IOCTL_STOP: case SNDRV_TIMER_IOCTL_STOP:
...@@ -1715,7 +1717,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on) ...@@ -1715,7 +1717,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)
return 0; 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; snd_timer_user_t *tu;
long result = 0, unit; long result = 0, unit;
......
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