Commit 9d7a2c2d authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: rest of sound/core

The rest of sond/core annotated; reverted bogus addition of __user in
snd_seq_kernel_client_ctl() - I should've guessed from the name alone
;-)
parent e3b784cf
......@@ -158,7 +158,7 @@ extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_
extern int snd_seq_delete_kernel_client(int client);
extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop);
extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop);
extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void __user *arg);
extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
#define SNDRV_SEQ_EXT_MASK 0xc0000000
#define SNDRV_SEQ_EXT_USRPTR 0x80000000
......
......@@ -81,7 +81,7 @@ static int snd_mixer_oss_release(struct inode *inode, struct file *file)
}
static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer,
mixer_info *_info)
mixer_info __user *_info)
{
snd_card_t *card = fmixer->card;
snd_mixer_oss_t *mixer = fmixer->mixer;
......@@ -97,7 +97,7 @@ static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer,
}
static int snd_mixer_oss_info_obsolete(snd_mixer_oss_file_t *fmixer,
_old_mixer_info *_info)
_old_mixer_info __user *_info)
{
snd_card_t *card = fmixer->card;
snd_mixer_oss_t *mixer = fmixer->mixer;
......@@ -293,65 +293,67 @@ static int snd_mixer_oss_set_volume(snd_mixer_oss_file_t *fmixer,
static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int tmp;
snd_assert(fmixer != NULL, return -ENXIO);
if (((cmd >> 8) & 0xff) == 'M') {
switch (cmd) {
case SOUND_MIXER_INFO:
return snd_mixer_oss_info(fmixer, (mixer_info *)arg);
return snd_mixer_oss_info(fmixer, argp);
case SOUND_OLD_MIXER_INFO:
return snd_mixer_oss_info_obsolete(fmixer, (_old_mixer_info *)arg);
return snd_mixer_oss_info_obsolete(fmixer, argp);
case SOUND_MIXER_WRITE_RECSRC:
if (get_user(tmp, (int *)arg))
if (get_user(tmp, p))
return -EFAULT;
tmp = snd_mixer_oss_set_recsrc(fmixer, tmp);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
case OSS_GETVERSION:
return put_user(SNDRV_OSS_VERSION, (int *) arg);
return put_user(SNDRV_OSS_VERSION, p);
case OSS_ALSAEMULVER:
return put_user(1, (int *) arg);
return put_user(1, p);
case SOUND_MIXER_READ_DEVMASK:
tmp = snd_mixer_oss_devmask(fmixer);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
case SOUND_MIXER_READ_STEREODEVS:
tmp = snd_mixer_oss_stereodevs(fmixer);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
case SOUND_MIXER_READ_RECMASK:
tmp = snd_mixer_oss_recmask(fmixer);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
case SOUND_MIXER_READ_CAPS:
tmp = snd_mixer_oss_caps(fmixer);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
case SOUND_MIXER_READ_RECSRC:
tmp = snd_mixer_oss_get_recsrc(fmixer);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
}
}
if (cmd & SIOC_IN) {
if (get_user(tmp, (int *)arg))
if (get_user(tmp, p))
return -EFAULT;
tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
} else if (cmd & SIOC_OUT) {
tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff);
if (tmp < 0)
return tmp;
return put_user(tmp, (int *)arg);
return put_user(tmp, p);
}
return -ENXIO;
}
......
......@@ -806,7 +806,7 @@ static ssize_t snd_pcm_oss_write2(snd_pcm_substream_t *substream, const char *bu
return bytes;
}
static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *buf, size_t bytes)
static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __user *buf, size_t bytes)
{
size_t xfer = 0;
ssize_t tmp;
......@@ -883,7 +883,7 @@ static ssize_t snd_pcm_oss_read2(snd_pcm_substream_t *substream, char *buf, size
return bytes;
}
static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size_t bytes)
static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *buf, size_t bytes)
{
size_t xfer = 0;
ssize_t tmp;
......@@ -1067,9 +1067,9 @@ static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file)
snd_pcm_lib_write(substream, runtime->oss.buffer, size1);
}
} else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) {
void *buffers[runtime->channels];
void __user *buffers[runtime->channels];
memset(buffers, 0, runtime->channels * sizeof(void *));
snd_pcm_lib_writev(substream, (void **)buffers, size);
snd_pcm_lib_writev(substream, buffers, size);
}
}
/*
......@@ -1468,7 +1468,7 @@ static int snd_pcm_oss_get_odelay(snd_pcm_oss_file_t *pcm_oss_file)
return snd_pcm_oss_bytes(substream, delay);
}
static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info * _info)
static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info __user * _info)
{
snd_pcm_substream_t *substream;
snd_pcm_runtime_t *runtime;
......@@ -1530,7 +1530,7 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str
return 0;
}
static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info *_info)
static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info __user *_info)
{
snd_pcm_substream_t *substream;
snd_pcm_runtime_t *runtime;
......@@ -1589,7 +1589,7 @@ static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, s
return 0;
}
static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc * _info)
static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc __user * _info)
{
// it won't be probably implemented
// snd_printd("TODO: snd_pcm_oss_get_mapbuf\n");
......@@ -1912,13 +1912,14 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
snd_pcm_oss_file_t *pcm_oss_file;
int __user *p = (int __user *)arg;
int res;
pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return -ENXIO);
if (cmd == OSS_GETVERSION)
return put_user(SNDRV_OSS_VERSION, (int *)arg);
return put_user(SNDRV_OSS_VERSION, p);
if (cmd == OSS_ALSAEMULVER)
return put_user(1, (int *)arg);
return put_user(1, p);
#if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE))
if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */
snd_pcm_substream_t *substream;
......@@ -1943,93 +1944,93 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_SYNC:
return snd_pcm_oss_sync(pcm_oss_file);
case SNDCTL_DSP_SPEED:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
if ((res = snd_pcm_oss_set_rate(pcm_oss_file, res))<0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SOUND_PCM_READ_RATE:
res = snd_pcm_oss_get_rate(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_STEREO:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
res = res > 0 ? 2 : 1;
if ((res = snd_pcm_oss_set_channels(pcm_oss_file, res)) < 0)
return res;
return put_user(--res, (int *)arg);
return put_user(--res, p);
case SNDCTL_DSP_GETBLKSIZE:
res = snd_pcm_oss_get_block_size(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_SETFMT:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
res = snd_pcm_oss_set_format(pcm_oss_file, res);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SOUND_PCM_READ_BITS:
res = snd_pcm_oss_get_format(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_CHANNELS:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
res = snd_pcm_oss_set_channels(pcm_oss_file, res);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SOUND_PCM_READ_CHANNELS:
res = snd_pcm_oss_get_channels(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SOUND_PCM_WRITE_FILTER:
case SOUND_PCM_READ_FILTER:
return -EIO;
case SNDCTL_DSP_POST:
return snd_pcm_oss_post(pcm_oss_file);
case SNDCTL_DSP_SUBDIVIDE:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
res = snd_pcm_oss_set_subdivide(pcm_oss_file, res);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_SETFRAGMENT:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
return snd_pcm_oss_set_fragment(pcm_oss_file, res);
case SNDCTL_DSP_GETFMTS:
res = snd_pcm_oss_get_formats(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_GETOSPACE:
case SNDCTL_DSP_GETISPACE:
return snd_pcm_oss_get_space(pcm_oss_file,
cmd == SNDCTL_DSP_GETISPACE ?
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
(struct audio_buf_info *) arg);
(struct audio_buf_info __user *) arg);
case SNDCTL_DSP_NONBLOCK:
return snd_pcm_oss_nonblock(file);
case SNDCTL_DSP_GETCAPS:
res = snd_pcm_oss_get_caps(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_GETTRIGGER:
res = snd_pcm_oss_get_trigger(pcm_oss_file);
if (res < 0)
return res;
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_SETTRIGGER:
if (get_user(res, (int *)arg))
if (get_user(res, p))
return -EFAULT;
return snd_pcm_oss_set_trigger(pcm_oss_file, res);
case SNDCTL_DSP_GETIPTR:
......@@ -2037,13 +2038,13 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
return snd_pcm_oss_get_ptr(pcm_oss_file,
cmd == SNDCTL_DSP_GETIPTR ?
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
(struct count_info *) arg);
(struct count_info __user *) arg);
case SNDCTL_DSP_MAPINBUF:
case SNDCTL_DSP_MAPOUTBUF:
return snd_pcm_oss_get_mapbuf(pcm_oss_file,
cmd == SNDCTL_DSP_MAPINBUF ?
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
(struct buffmem_desc *) arg);
(struct buffmem_desc __user *) arg);
case SNDCTL_DSP_SETSYNCRO:
/* stop DMA now.. */
return 0;
......@@ -2055,10 +2056,10 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
res = snd_pcm_oss_get_odelay(pcm_oss_file);
if (res < 0) {
/* it's for sure, some broken apps don't check for error codes */
put_user(0, (int *)arg);
put_user(0, p);
return res;
}
return put_user(res, (int *)arg);
return put_user(res, p);
case SNDCTL_DSP_PROFILE:
return 0; /* silently ignore */
default:
......@@ -2067,7 +2068,7 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
return -EINVAL;
}
static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff_t *offset)
static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
snd_pcm_oss_file_t *pcm_oss_file;
snd_pcm_substream_t *substream;
......@@ -2087,7 +2088,7 @@ static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff
#endif
}
static ssize_t snd_pcm_oss_write(struct file *file, const char *buf, size_t count, loff_t *offset)
static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
{
snd_pcm_oss_file_t *pcm_oss_file;
snd_pcm_substream_t *substream;
......
......@@ -35,7 +35,7 @@ MODULE_SUPPORTED_DEVICE("sound");
char *snd_seq_fm_id = SNDRV_SEQ_INSTR_ID_OPL2_3;
static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic, int cmd)
{
fm_instrument_t *ip;
fm_xinstrument_t ix;
......@@ -77,7 +77,8 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
}
static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic,
int cmd)
{
fm_instrument_t *ip;
fm_xinstrument_t ix;
......
......@@ -48,7 +48,7 @@ static unsigned int snd_seq_gf1_size(unsigned int size, unsigned int format)
static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
gf1_instrument_t *ip,
char **data,
char __user **data,
long *len,
int atomic)
{
......@@ -141,7 +141,8 @@ static void snd_seq_gf1_instr_free(snd_gf1_ops_t *ops,
}
static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic,
int cmd)
{
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data;
gf1_instrument_t *ip;
......@@ -192,7 +193,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
gf1_instrument_t *ip,
char **data,
char __user **data,
long *len,
int atomic)
{
......@@ -253,7 +254,8 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
}
static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic,
int cmd)
{
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data;
gf1_instrument_t *ip;
......
......@@ -60,7 +60,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
iwffff_layer_t *lp,
iwffff_env_t *ep,
iwffff_xenv_t *ex,
char **data,
char __user **data,
long *len,
int gfp_mask)
{
......@@ -126,7 +126,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
iwffff_layer_t *lp,
char **data,
char __user **data,
long *len,
int atomic)
{
......@@ -230,7 +230,8 @@ static void snd_seq_iwffff_instr_free(snd_iwffff_ops_t *ops,
}
static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic,
int cmd)
{
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data;
iwffff_instrument_t *ip;
......@@ -350,7 +351,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
iwffff_layer_t *lp,
iwffff_xenv_t *ex,
iwffff_env_t *ep,
char **data,
char __user **data,
long *len)
{
iwffff_env_record_t *rp;
......@@ -395,7 +396,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
iwffff_layer_t *lp,
char **data,
char __user **data,
long *len,
int atomic)
{
......@@ -449,14 +450,14 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
}
static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len, int atomic, int cmd)
{
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data;
iwffff_instrument_t *ip;
iwffff_xinstrument_t ix;
iwffff_layer_t *lp;
iwffff_xlayer_t lx;
char *layer_instr_data;
char __user *layer_instr_data;
int err;
if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
......
......@@ -55,7 +55,8 @@ static void snd_seq_simple_instr_free(snd_simple_ops_t *ops,
}
static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len,
int atomic, int cmd)
{
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data;
simple_instrument_t *ip;
......@@ -103,7 +104,8 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
}
static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
char *instr_data, long len, int atomic, int cmd)
char __user *instr_data, long len,
int atomic, int cmd)
{
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data;
simple_instrument_t *ip;
......
......@@ -2154,17 +2154,17 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg
switch (cmd) {
case SNDRV_SEQ_IOCTL_PVERSION:
/* return sequencer version number */
return put_user(SNDRV_SEQ_VERSION, (int *)arg) ? -EFAULT : 0;
return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0;
case SNDRV_SEQ_IOCTL_CLIENT_ID:
/* return the id of this client */
return put_user(client->number, (int *)arg) ? -EFAULT : 0;
return put_user(client->number, (int __user *)arg) ? -EFAULT : 0;
}
if (! arg)
return -EFAULT;
for (p = ioctl_tables; p->cmd; p++) {
if (p->cmd == cmd)
return p->func(client, (void __user *) arg);
return p->func(client, arg);
}
snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%2x)\n",
cmd, _IOC_TYPE(cmd), _IOC_NR(cmd));
......@@ -2348,7 +2348,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
* exported, called by kernel clients to perform same functions as with
* userland ioctl()
*/
int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void __user *arg)
int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
{
client_t *client;
mm_segment_t fs;
......
......@@ -90,7 +90,7 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
char buf[32];
char *curptr = event->data.ext.ptr;
char __user *curptr = event->data.ext.ptr;
while (len > 0) {
int size = sizeof(buf);
if (len < size)
......
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