diff options
author | Alexander Viro <viro@www.linux.org.uk> | 2004-05-28 21:14:06 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-28 21:14:06 -0700 |
commit | 70c7987d068f8d67f342c4b029d4fdb5c1558635 (patch) | |
tree | 89133542074c31bf0bec59be0c7607d21a2d13e2 /sound | |
parent | aee997162e32f7367aaacdc34d98166117f6e47d (diff) | |
download | history-70c7987d068f8d67f342c4b029d4fdb5c1558635.tar.gz |
[PATCH] sparse: OSS __user annotation
caddr_t is gone (most of the instances were void __user * in disguise,
the rest - void *)
Fixed b0rken ioctls in mpu401 and pss - they used to dereference
userland pointers with no checks.
Diffstat (limited to 'sound')
42 files changed, 478 insertions, 419 deletions
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 5504605adc7420..d3193b03ec24e6 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c @@ -24,7 +24,7 @@ static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure); static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg); static int snd_opl3_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg); -static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char *buf, int offs, int count); +static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count); static int snd_opl3_reset_seq_oss(snd_seq_oss_arg_t *arg); /* */ @@ -207,7 +207,7 @@ static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg) #define SBFM_MAXINSTR 256 static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, - const char *buf, int offs, int count) + const char __user *buf, int offs, int count) { opl3_t *opl3; int err = -EINVAL; diff --git a/sound/oss/ac97.c b/sound/oss/ac97.c index 258060ecbb6a51..d79ff775404712 100644 --- a/sound/oss/ac97.c +++ b/sound/oss/ac97.c @@ -369,7 +369,7 @@ ac97_set_values (struct ac97_hwint *dev, } int -ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg) +ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, void __user *arg) { int ret; @@ -380,7 +380,7 @@ ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg) case SOUND_MIXER_WRITE_RECSRC: { - if (get_user (ret, (int *) arg)) + if (get_user (ret, (int __user *) arg)) ret = -EFAULT; else ret = ac97_set_recmask (dev, ret); @@ -414,7 +414,7 @@ ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg) ret = 0; if (dir & _SIOC_WRITE) { int val; - if (get_user (val, (int *) arg) == 0) + if (get_user (val, (int __user *) arg) == 0) ret = ac97_set_mixer (dev, channel, val); else ret = -EFAULT; @@ -434,7 +434,7 @@ ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg) if (ret < 0) return ret; else - return put_user(ret, (int *) arg); + return put_user(ret, (int __user *) arg); } EXPORT_SYMBOL(ac97_init); diff --git a/sound/oss/ac97.h b/sound/oss/ac97.h index 6353b79b6c94a7..3353c84b556f83 100644 --- a/sound/oss/ac97.h +++ b/sound/oss/ac97.h @@ -206,7 +206,7 @@ extern int ac97_get_mixer_scaled (struct ac97_hwint *dev, int oss_channel); /* Default ioctl. */ extern int ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, - caddr_t arg); + void __user * arg); /* Do a complete reset on the AC97 mixer, restoring all mixer registers to the current values. Normally used after an APM resume event. */ diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c index 4b33c2f8e871d4..c883411dacaf8f 100644 --- a/sound/oss/ac97_codec.c +++ b/sound/oss/ac97_codec.c @@ -516,7 +516,7 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned strlcpy(info.id, codec->name, sizeof(info.id)); strlcpy(info.name, codec->name, sizeof(info.name)); info.modify_counter = codec->modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -525,7 +525,7 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned memset(&info, 0, sizeof(info)); strlcpy(info.id, codec->name, sizeof(info.id)); strlcpy(info.name, codec->name, sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -534,7 +534,7 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned return -EINVAL; if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, (int __user *)arg); if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { @@ -573,12 +573,12 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned val = codec->mixer_state[i]; break; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) { codec->modcnt++; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; switch (_IOC_NR(cmd)) { diff --git a/sound/oss/aci.c b/sound/oss/aci.c index 20af39fcab8b88..5c3c7e5996752a 100644 --- a/sound/oss/aci.c +++ b/sound/oss/aci.c @@ -234,12 +234,12 @@ out: return read; EXPORT_SYMBOL(aci_rw_cmd); -static int setvolume(caddr_t arg, +static int setvolume(int __user *arg, unsigned char left_index, unsigned char right_index) { int vol, ret, uservol, buf; - __get_user(uservol, (int *)arg); + __get_user(uservol, arg); /* left channel */ vol = uservol & 0xff; @@ -260,12 +260,12 @@ static int setvolume(caddr_t arg, return buf; ret |= SCALE(0x20, 100, vol) << 8; - __put_user(ret, (int *)arg); + __put_user(ret, arg); return 0; } -static int getvolume(caddr_t arg, +static int getvolume(int __user *arg, unsigned char left_index, unsigned char right_index) { int vol; @@ -281,7 +281,7 @@ static int getvolume(caddr_t arg, return buf; vol |= SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0) << 8; - __put_user(vol, (int *)arg); + __put_user(vol, arg); return 0; } @@ -318,13 +318,13 @@ static inline unsigned int eq_aci2oss(unsigned int vol) } -static int setequalizer(caddr_t arg, +static int setequalizer(int __user *arg, unsigned char left_index, unsigned char right_index) { int buf; unsigned int vol; - __get_user(vol, (int *)arg); + __get_user(vol, arg); /* left channel */ if ((buf=aci_write_cmd(left_index, eq_oss2aci(vol & 0xff)))<0) @@ -338,7 +338,7 @@ static int setequalizer(caddr_t arg, return 0; } -static int getequalizer(caddr_t arg, +static int getequalizer(int __user *arg, unsigned char left_index, unsigned char right_index) { int buf; @@ -354,50 +354,51 @@ static int getequalizer(caddr_t arg, return buf; vol |= eq_aci2oss(buf) << 8; - __put_user(vol, (int *)arg); + __put_user(vol, arg); return 0; } -static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) +static int aci_mixer_ioctl (int dev, unsigned int cmd, void __user * arg) { int vol, buf; + int __user *p; switch (cmd) { case SOUND_MIXER_WRITE_VOLUME: - return setvolume(arg, 0x01, 0x00); + return setvolume(p, 0x01, 0x00); case SOUND_MIXER_WRITE_CD: - return setvolume(arg, 0x3c, 0x34); + return setvolume(p, 0x3c, 0x34); case SOUND_MIXER_WRITE_MIC: - return setvolume(arg, 0x38, 0x30); + return setvolume(p, 0x38, 0x30); case SOUND_MIXER_WRITE_LINE: - return setvolume(arg, 0x39, 0x31); + return setvolume(p, 0x39, 0x31); case SOUND_MIXER_WRITE_SYNTH: - return setvolume(arg, 0x3b, 0x33); + return setvolume(p, 0x3b, 0x33); case SOUND_MIXER_WRITE_PCM: - return setvolume(arg, 0x3a, 0x32); + return setvolume(p, 0x3a, 0x32); case MIXER_WRITE(SOUND_MIXER_RADIO): /* fall through */ case SOUND_MIXER_WRITE_LINE1: /* AUX1 or radio */ - return setvolume(arg, 0x3d, 0x35); + return setvolume(p, 0x3d, 0x35); case SOUND_MIXER_WRITE_LINE2: /* AUX2 */ - return setvolume(arg, 0x3e, 0x36); + return setvolume(p, 0x3e, 0x36); case SOUND_MIXER_WRITE_BASS: /* set band one and two */ if (aci_idcode[1]=='C') { - if ((buf=setequalizer(arg, 0x48, 0x40)) || - (buf=setequalizer(arg, 0x49, 0x41))); + if ((buf=setequalizer(p, 0x48, 0x40)) || + (buf=setequalizer(p, 0x49, 0x41))); return buf; } break; case SOUND_MIXER_WRITE_TREBLE: /* set band six and seven */ if (aci_idcode[1]=='C') { - if ((buf=setequalizer(arg, 0x4d, 0x45)) || - (buf=setequalizer(arg, 0x4e, 0x46))); + if ((buf=setequalizer(p, 0x4d, 0x45)) || + (buf=setequalizer(p, 0x4e, 0x46))); return buf; } break; case SOUND_MIXER_WRITE_IGAIN: /* MIC pre-amp */ if (aci_idcode[1]=='B' || aci_idcode[1]=='C') { - __get_user(vol, (int *)arg); + __get_user(vol, p); vol = vol & 0xff; if (vol > 100) vol = 100; @@ -407,13 +408,13 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) aci_micpreamp = vol; vol = SCALE(3, 100, vol); vol |= (vol << 8); - __put_user(vol, (int *)arg); + __put_user(vol, p); return 0; } break; case SOUND_MIXER_WRITE_OGAIN: /* Power-amp/line-out level */ if (aci_idcode[1]=='A' || aci_idcode[1]=='B') { - __get_user(buf, (int *)arg); + __get_user(buf, p); buf = buf & 0xff; if (buf > 50) vol = 1; @@ -426,13 +427,13 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) buf = (100 || 100<<8); else buf = 0; - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; } break; case SOUND_MIXER_WRITE_RECSRC: /* handle solo mode control */ - __get_user(buf, (int *)arg); + __get_user(buf, p); /* unset solo when RECSRC for PCM is requested */ if (aci_idcode[1]=='B' || aci_idcode[1]=='C') { vol = !(buf & SOUND_MASK_PCM); @@ -448,7 +449,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) buf |= SOUND_MASK_LINE1; if (!aci_solo) buf |= SOUND_MASK_PCM; - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; case SOUND_MIXER_READ_DEVMASK: buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD | @@ -470,7 +471,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) default: buf |= SOUND_MASK_LINE1; } - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; case SOUND_MIXER_READ_STEREODEVS: buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD | @@ -485,7 +486,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) default: buf |= SOUND_MASK_LINE1; } - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; case SOUND_MIXER_READ_RECMASK: buf = (SOUND_MASK_CD| SOUND_MASK_MIC| SOUND_MASK_LINE| @@ -495,7 +496,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) else buf |= SOUND_MASK_LINE1; - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; case SOUND_MIXER_READ_RECSRC: buf = (SOUND_MASK_CD | SOUND_MASK_MIC | SOUND_MASK_LINE | @@ -523,36 +524,36 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) else buf |= SOUND_MASK_LINE1; - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; case SOUND_MIXER_READ_CAPS: - __put_user(0, (int *)arg); + __put_user(0, p); return 0; case SOUND_MIXER_READ_VOLUME: - return getvolume(arg, 0x04, 0x03); + return getvolume(p, 0x04, 0x03); case SOUND_MIXER_READ_CD: - return getvolume(arg, 0x0a, 0x09); + return getvolume(p, 0x0a, 0x09); case SOUND_MIXER_READ_MIC: - return getvolume(arg, 0x06, 0x05); + return getvolume(p, 0x06, 0x05); case SOUND_MIXER_READ_LINE: - return getvolume(arg, 0x08, 0x07); + return getvolume(p, 0x08, 0x07); case SOUND_MIXER_READ_SYNTH: - return getvolume(arg, 0x0c, 0x0b); + return getvolume(p, 0x0c, 0x0b); case SOUND_MIXER_READ_PCM: - return getvolume(arg, 0x0e, 0x0d); + return getvolume(p, 0x0e, 0x0d); case MIXER_READ(SOUND_MIXER_RADIO): /* fall through */ case SOUND_MIXER_READ_LINE1: /* AUX1 */ - return getvolume(arg, 0x11, 0x10); + return getvolume(p, 0x11, 0x10); case SOUND_MIXER_READ_LINE2: /* AUX2 */ - return getvolume(arg, 0x13, 0x12); + return getvolume(p, 0x13, 0x12); case SOUND_MIXER_READ_BASS: /* get band one */ if (aci_idcode[1]=='C') { - return getequalizer(arg, 0x23, 0x22); + return getequalizer(p, 0x23, 0x22); } break; case SOUND_MIXER_READ_TREBLE: /* get band seven */ if (aci_idcode[1]=='C') { - return getequalizer(arg, 0x2f, 0x2e); + return getequalizer(p, 0x2f, 0x2e); } break; case SOUND_MIXER_READ_IGAIN: /* MIC pre-amp */ @@ -567,7 +568,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) buf=aci_micpreamp; vol = SCALE(3, 100, buf <= 3 ? buf : 3); vol |= vol << 8; - __put_user(vol, (int *)arg); + __put_user(vol, p); return 0; } break; @@ -576,7 +577,7 @@ static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) buf = (100 || 100<<8); else buf = 0; - __put_user(buf, (int *)arg); + __put_user(buf, p); return 0; } return -EINVAL; diff --git a/sound/oss/ad1816.c b/sound/oss/ad1816.c index 258bb4ef9bf865..c2abdddd7fe2fe 100644 --- a/sound/oss/ad1816.c +++ b/sound/oss/ad1816.c @@ -874,10 +874,11 @@ ad1816_mixer_reset (ad1816_info * devc) } static int -ad1816_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) +ad1816_mixer_ioctl (int dev, unsigned int cmd, void __user * arg) { ad1816_info *devc = mixer_devs[dev]->devc; int val; + int __user *p = arg; DEBUGNOISE(printk(KERN_DEBUG "ad1816: mixer_ioctl called!\n")); @@ -889,19 +890,19 @@ ad1816_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) switch (cmd & 0xff){ case SOUND_MIXER_RECSRC: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val=ad1816_set_recmask (devc, val); - return put_user(val, (int *)arg); + return put_user(val, p); break; default: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if ((val=ad1816_mixer_set (devc, cmd & 0xff, val))<0) return val; else - return put_user(val, (int *)arg); + return put_user(val, p); } } else { /* read ioctl */ @@ -909,34 +910,34 @@ ad1816_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) case SOUND_MIXER_RECSRC: val=devc->recmask; - return put_user(val, (int *)arg); + return put_user(val, p); break; case SOUND_MIXER_DEVMASK: val=devc->supported_devices; - return put_user(val, (int *)arg); + return put_user(val, p); break; case SOUND_MIXER_STEREODEVS: val=devc->supported_devices & ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX); - return put_user(val, (int *)arg); + return put_user(val, p); break; case SOUND_MIXER_RECMASK: val=devc->supported_rec_devices; - return put_user(val, (int *)arg); + return put_user(val, p); break; case SOUND_MIXER_CAPS: val=SOUND_CAP_EXCL_INPUT; - return put_user(val, (int *)arg); + return put_user(val, p); break; default: if ((val=ad1816_mixer_get (devc, cmd & 0xff))<0) return val; else - return put_user(val, (int *)arg); + return put_user(val, p); } } } else diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 585a4427495d1d..7e9e30e5b75117 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -673,14 +673,14 @@ static void ad1848_mixer_reset(ad1848_info * devc) spin_unlock_irqrestore(&devc->lock,flags); } -static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int ad1848_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { ad1848_info *devc = mixer_devs[dev]->devc; int val; if (cmd == SOUND_MIXER_PRIVATE1) { - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; if (val != 0xffff) @@ -698,11 +698,11 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) spin_unlock_irqrestore(&devc->lock,flags); } val = devc->mixer_output_port; - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } if (cmd == SOUND_MIXER_PRIVATE2) { - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; return(ad1848_control(AD1848_MIXER_REROUTE, val)); } @@ -713,18 +713,18 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = ad1848_set_recmask(devc, val); break; default: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = ad1848_mixer_set(devc, cmd & 0xff, val); break; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } else { @@ -760,7 +760,7 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) val = ad1848_mixer_get(devc, cmd & 0xff); break; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } } else diff --git a/sound/oss/audio.c b/sound/oss/audio.c index 91101d990e493e..ef2c658af4cb21 100644 --- a/sound/oss/audio.c +++ b/sound/oss/audio.c @@ -38,7 +38,7 @@ #define NEUTRAL16 0x00 -int dma_ioctl(int dev, unsigned int cmd, caddr_t arg); +int dma_ioctl(int dev, unsigned int cmd, void __user *arg); static int set_format(int dev, int fmt) { @@ -219,7 +219,7 @@ static void translate_bytes(const unsigned char *table, unsigned char *buff, int buff[i] = table[buff[i]]; } -int audio_write(int dev, struct file *file, const char *buf, int count) +int audio_write(int dev, struct file *file, const char __user *buf, int count) { int c, p, l, buf_size, used, returned; int err; @@ -300,7 +300,7 @@ int audio_write(int dev, struct file *file, const char *buf, int count) return count; } -int audio_read(int dev, struct file *file, char *buf, int count) +int audio_read(int dev, struct file *file, char __user *buf, int count) { int c, p, l; char *dmabuf; @@ -365,11 +365,12 @@ int audio_read(int dev, struct file *file, char *buf, int count) return count - c; } -int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) +int audio_ioctl(int dev, struct file *file, unsigned int cmd, void __user *arg) { int val, count; unsigned long flags; struct dma_buffparms *dmap; + int __user *p = arg; dev = dev >> 4; @@ -399,7 +400,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return 0; audio_devs[dev]->dmap_out->flags |= DMA_POST | DMA_DIRTY; sync_output(dev); - dma_ioctl(dev, SNDCTL_DSP_POST, (caddr_t) 0); + dma_ioctl(dev, SNDCTL_DSP_POST, NULL); return 0; case SNDCTL_DSP_RESET: @@ -412,7 +413,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val = set_format(dev, val); break; @@ -449,7 +450,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SOUND_PCM_WRITE_RATE: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val = audio_devs[dev]->d->set_speed(dev, val); break; @@ -459,7 +460,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val > 1 || val < 0) return -EINVAL; @@ -467,7 +468,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SOUND_PCM_WRITE_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val = audio_devs[dev]->d->set_channels(dev, val); break; @@ -486,7 +487,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return (audio_devs[dev]->flags & DMA_DUPLEX) ? 0 : -EIO; case SNDCTL_DSP_PROFILE: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (audio_devs[dev]->open_mode & OPEN_WRITE) audio_devs[dev]->dmap_out->applic_profile = val; @@ -522,7 +523,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) default: return dma_ioctl(dev, cmd, arg); } - return put_user(val, (int *)arg); + return put_user(val, p); } void audio_init_devices(void) @@ -734,7 +735,7 @@ static int dma_set_fragment(int dev, struct dma_buffparms *dmap, int fact) return bytes | ((count - 1) << 16); } -int dma_ioctl(int dev, unsigned int cmd, caddr_t arg) +int dma_ioctl(int dev, unsigned int cmd, void __user *arg) { struct dma_buffparms *dmap_out = audio_devs[dev]->dmap_out; struct dma_buffparms *dmap_in = audio_devs[dev]->dmap_in; @@ -748,7 +749,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg) { case SNDCTL_DSP_SUBDIVIDE: ret = 0; - if (get_user(fact, (int *)arg)) + if (get_user(fact, (int __user *)arg)) return -EFAULT; if (audio_devs[dev]->open_mode & OPEN_WRITE) ret = dma_subdivide(dev, dmap_out, fact); @@ -816,7 +817,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_DSP_SETTRIGGER: - if (get_user(bits, (int *)arg)) + if (get_user(bits, (int __user *)arg)) return -EFAULT; bits &= audio_devs[dev]->open_mode; if (audio_devs[dev]->d->trigger == NULL) @@ -957,7 +958,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg) case SNDCTL_DSP_SETFRAGMENT: ret = 0; - if (get_user(fact, (int *)arg)) + if (get_user(fact, (int __user *)arg)) return -EFAULT; if (audio_devs[dev]->open_mode & OPEN_WRITE) ret = dma_set_fragment(dev, dmap_out, fact); @@ -978,5 +979,5 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg) return -EINVAL; return audio_devs[dev]->d->ioctl(dev, cmd, arg); } - return put_user(ret, (int *)arg); + return put_user(ret, (int __user *)arg); } diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index 6aac55d4a545d5..e53bd26297985f 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c @@ -336,14 +336,14 @@ static void awe_modwheel_change(int voice, int value); /* sequencer interface */ static int awe_open(int dev, int mode); static void awe_close(int dev); -static int awe_ioctl(int dev, unsigned int cmd, caddr_t arg); +static int awe_ioctl(int dev, unsigned int cmd, void __user * arg); static int awe_kill_note(int dev, int voice, int note, int velocity); static int awe_start_note(int dev, int v, int note_num, int volume); static int awe_set_instr(int dev, int voice, int instr_no); static int awe_set_instr_2(int dev, int voice, int instr_no); static void awe_reset(int dev); static void awe_hw_control(int dev, unsigned char *event); -static int awe_load_patch(int dev, int format, const char *addr, +static int awe_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag); static void awe_aftertouch(int dev, int voice, int pressure); static void awe_controller(int dev, int voice, int ctrl_num, int value); @@ -374,21 +374,21 @@ static void awe_alloc_one_voice(int voice, int note, int velocity); static int awe_clear_voice(void); /* load / remove patches */ -static int awe_open_patch(awe_patch_info *patch, const char *addr, int count); -static int awe_close_patch(awe_patch_info *patch, const char *addr, int count); -static int awe_unload_patch(awe_patch_info *patch, const char *addr, int count); -static int awe_load_info(awe_patch_info *patch, const char *addr, int count); -static int awe_remove_info(awe_patch_info *patch, const char *addr, int count); -static int awe_load_data(awe_patch_info *patch, const char *addr, int count); -static int awe_replace_data(awe_patch_info *patch, const char *addr, int count); -static int awe_load_map(awe_patch_info *patch, const char *addr, int count); +static int awe_open_patch(awe_patch_info *patch, const char __user *addr, int count); +static int awe_close_patch(awe_patch_info *patch, const char __user *addr, int count); +static int awe_unload_patch(awe_patch_info *patch, const char __user *addr, int count); +static int awe_load_info(awe_patch_info *patch, const char __user *addr, int count); +static int awe_remove_info(awe_patch_info *patch, const char __user *addr, int count); +static int awe_load_data(awe_patch_info *patch, const char __user *addr, int count); +static int awe_replace_data(awe_patch_info *patch, const char __user *addr, int count); +static int awe_load_map(awe_patch_info *patch, const char __user *addr, int count); #ifdef AWE_HAS_GUS_COMPATIBILITY -static int awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag); +static int awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag); #endif -/*static int awe_probe_info(awe_patch_info *patch, const char *addr, int count);*/ -static int awe_probe_data(awe_patch_info *patch, const char *addr, int count); +/*static int awe_probe_info(awe_patch_info *patch, const char __user *addr, int count);*/ +static int awe_probe_data(awe_patch_info *patch, const char __user *addr, int count); static sf_list *check_patch_opened(int type, char *name); -static int awe_write_wave_data(const char *addr, int offset, awe_sample_list *sp, int channels); +static int awe_write_wave_data(const char __user *addr, int offset, awe_sample_list *sp, int channels); static int awe_create_sf(int type, char *name); static void awe_free_sf(sf_list *sf); static void add_sf_info(sf_list *sf, awe_voice_list *rec); @@ -422,10 +422,10 @@ static void awe_close_dram(void); static int awe_detect_base(int addr); static int awe_detect(void); static void awe_check_dram(void); -static int awe_load_chorus_fx(awe_patch_info *patch, const char *addr, int count); +static int awe_load_chorus_fx(awe_patch_info *patch, const char __user *addr, int count); static void awe_set_chorus_mode(int mode); static void awe_update_chorus_mode(void); -static int awe_load_reverb_fx(awe_patch_info *patch, const char *addr, int count); +static int awe_load_reverb_fx(awe_patch_info *patch, const char __user *addr, int count); static void awe_set_reverb_mode(int mode); static void awe_update_reverb_mode(void); static void awe_equalizer(int bass, int treble); @@ -1865,7 +1865,7 @@ awe_init_ctrl_parms(int init_all) /* sequencer I/O control: */ static int -awe_ioctl(int dev, unsigned int cmd, caddr_t arg) +awe_ioctl(int dev, unsigned int cmd, void __user *arg) { switch (cmd) { case SNDCTL_SYNTH_INFO: @@ -1873,7 +1873,7 @@ awe_ioctl(int dev, unsigned int cmd, caddr_t arg) awe_info.nr_voices = awe_max_voices; else awe_info.nr_voices = AWE_MAX_CHANNELS; - if (copy_to_user((char*)arg, &awe_info, sizeof(awe_info))) + if (copy_to_user(arg, &awe_info, sizeof(awe_info))) return -EFAULT; return 0; break; @@ -2656,7 +2656,7 @@ awe_bender(int dev, int voice, int value) */ static int -awe_load_patch(int dev, int format, const char *addr, +awe_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { awe_patch_info patch; @@ -2865,7 +2865,7 @@ awe_free_sf(sf_list *sf) /* open patch; create sf list and set opened flag */ static int -awe_open_patch(awe_patch_info *patch, const char *addr, int count) +awe_open_patch(awe_patch_info *patch, const char __user *addr, int count) { awe_open_parm parm; int shared; @@ -2913,7 +2913,7 @@ check_patch_opened(int type, char *name) /* close the patch; if no voice is loaded, remove the patch */ static int -awe_close_patch(awe_patch_info *patch, const char *addr, int count) +awe_close_patch(awe_patch_info *patch, const char __user *addr, int count) { if (patch_opened && sftail) { /* if no voice is loaded, release the current patch */ @@ -2929,7 +2929,7 @@ awe_close_patch(awe_patch_info *patch, const char *addr, int count) /* remove the latest patch */ static int -awe_unload_patch(awe_patch_info *patch, const char *addr, int count) +awe_unload_patch(awe_patch_info *patch, const char __user *addr, int count) { if (current_sf_id > 0 && current_sf_id > locked_sf_id) { awe_reset(0); @@ -2968,7 +2968,7 @@ alloc_new_sample(void) /* load voice map */ static int -awe_load_map(awe_patch_info *patch, const char *addr, int count) +awe_load_map(awe_patch_info *patch, const char __user *addr, int count) { awe_voice_map map; awe_voice_list *rec, *p; @@ -3019,7 +3019,7 @@ awe_load_map(awe_patch_info *patch, const char *addr, int count) #if 0 /* probe preset in the current list -- nothing to be loaded */ static int -awe_probe_info(awe_patch_info *patch, const char *addr, int count) +awe_probe_info(awe_patch_info *patch, const char __user *addr, int count) { #ifdef AWE_ALLOW_SAMPLE_SHARING awe_voice_map map; @@ -3054,7 +3054,7 @@ awe_probe_info(awe_patch_info *patch, const char *addr, int count) /* probe sample in the current list -- nothing to be loaded */ static int -awe_probe_data(awe_patch_info *patch, const char *addr, int count) +awe_probe_data(awe_patch_info *patch, const char __user *addr, int count) { #ifdef AWE_ALLOW_SAMPLE_SHARING if (! patch_opened) @@ -3100,7 +3100,7 @@ remove_info(sf_list *sf, int bank, int instr) /* load voice information data */ static int -awe_load_info(awe_patch_info *patch, const char *addr, int count) +awe_load_info(awe_patch_info *patch, const char __user *addr, int count) { int offset; awe_voice_rec_hdr hdr; @@ -3188,7 +3188,7 @@ awe_load_info(awe_patch_info *patch, const char *addr, int count) /* remove instrument layers */ static int -awe_remove_info(awe_patch_info *patch, const char *addr, int count) +awe_remove_info(awe_patch_info *patch, const char __user *addr, int count) { unsigned char bank, instr; sf_list *sf; @@ -3208,7 +3208,7 @@ awe_remove_info(awe_patch_info *patch, const char *addr, int count) /* load wave sample data */ static int -awe_load_data(awe_patch_info *patch, const char *addr, int count) +awe_load_data(awe_patch_info *patch, const char __user *addr, int count) { int offset, size; int rc; @@ -3260,7 +3260,7 @@ awe_load_data(awe_patch_info *patch, const char *addr, int count) /* replace wave sample data */ static int -awe_replace_data(awe_patch_info *patch, const char *addr, int count) +awe_replace_data(awe_patch_info *patch, const char __user *addr, int count) { int offset; int size; @@ -3322,13 +3322,13 @@ awe_replace_data(awe_patch_info *patch, const char *addr, int count) /*----------------------------------------------------------------*/ -static const char *readbuf_addr; +static const char __user *readbuf_addr; static int readbuf_offs; static int readbuf_flags; /* initialize read buffer */ static int -readbuf_init(const char *addr, int offset, awe_sample_info *sp) +readbuf_init(const char __user *addr, int offset, awe_sample_info *sp) { readbuf_addr = addr; readbuf_offs = offset; @@ -3344,10 +3344,10 @@ readbuf_word(int pos) /* read from user buffer */ if (readbuf_flags & AWE_SAMPLE_8BITS) { unsigned char cc; - get_user(cc, (unsigned char*)(readbuf_addr + readbuf_offs + pos)); + get_user(cc, (unsigned __user char*)(readbuf_addr + readbuf_offs + pos)); c = (unsigned short)cc << 8; /* convert 8bit -> 16bit */ } else { - get_user(c, (unsigned short*)(readbuf_addr + readbuf_offs + pos * 2)); + get_user(c, (unsigned __user short*)(readbuf_addr + readbuf_offs + pos * 2)); } if (readbuf_flags & AWE_SAMPLE_UNSIGNED) c ^= 0x8000; /* unsigned -> signed */ @@ -3365,7 +3365,7 @@ readbuf_word(int pos) /* loading onto memory - return the actual written size */ static int -awe_write_wave_data(const char *addr, int offset, awe_sample_list *list, int channels) +awe_write_wave_data(const char __user *addr, int offset, awe_sample_list *list, int channels) { int i, truesize, dram_offset; awe_sample_info *sp = &list->v; @@ -3481,7 +3481,7 @@ calc_gus_envelope_time(int rate, int start, int end) /* load GUS patch */ static int -awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag) +awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag) { struct patch_info patch; awe_voice_info *rec; @@ -4112,7 +4112,7 @@ awe_setup_voice(int dev, int voice, int chn) * AWE32 mixer device control */ -static int awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg); +static int awe_mixer_ioctl(int dev, unsigned int cmd, void __user *arg); static int my_mixerdev = -1; @@ -4137,14 +4137,14 @@ static void __exit unload_mixer(void) } static int -awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +awe_mixer_ioctl(int dev, unsigned int cmd, void __user * arg) { int i, level, value; if (((cmd >> 8) & 0xff) != 'M') return -EINVAL; - if (get_user(level, (int *)arg)) + if (get_user(level, (int __user *)arg)) return -EFAULT; level = ((level & 0xff) + (level >> 8)) / 2; DEBUG(0,printk("AWEMix: cmd=%x val=%d\n", cmd & 0xff, level)); @@ -4201,7 +4201,7 @@ awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) level = 0; break; } - if (put_user(level, (int *)arg)) + if (put_user(level, (int __user *)arg)) return -EFAULT; return level; } @@ -4662,7 +4662,7 @@ static awe_chorus_fx_rec chorus_parm[AWE_CHORUS_NUMBERS] = { }; static int -awe_load_chorus_fx(awe_patch_info *patch, const char *addr, int count) +awe_load_chorus_fx(awe_patch_info *patch, const char __user *addr, int count) { if (patch->optarg < AWE_CHORUS_PREDEFINED || patch->optarg >= AWE_CHORUS_NUMBERS) { printk(KERN_WARNING "AWE32 Error: invalid chorus mode %d for uploading\n", patch->optarg); @@ -4770,7 +4770,7 @@ static struct ReverbCmdPair { }; static int -awe_load_reverb_fx(awe_patch_info *patch, const char *addr, int count) +awe_load_reverb_fx(awe_patch_info *patch, const char __user *addr, int count) { if (patch->optarg < AWE_REVERB_PREDEFINED || patch->optarg >= AWE_REVERB_NUMBERS) { printk(KERN_WARNING "AWE32 Error: invalid reverb mode %d for uploading\n", patch->optarg); @@ -4915,7 +4915,7 @@ typedef struct { static int awe_midi_open(int dev, int mode, void (*input)(int,unsigned char), void (*output)(int)); static void awe_midi_close(int dev); -static int awe_midi_ioctl(int dev, unsigned cmd, caddr_t arg); +static int awe_midi_ioctl(int dev, unsigned cmd, void __user * arg); static int awe_midi_outputc(int dev, unsigned char midi_byte); static void init_midi_status(MidiStatus *st); @@ -5055,7 +5055,7 @@ awe_midi_close (int dev) static int -awe_midi_ioctl (int dev, unsigned cmd, caddr_t arg) +awe_midi_ioctl (int dev, unsigned cmd, void __user *arg) { return -EPERM; } diff --git a/sound/oss/dev_table.h b/sound/oss/dev_table.h index 7b74e92de119d5..2d43d28c7d1739 100644 --- a/sound/oss/dev_table.h +++ b/sound/oss/dev_table.h @@ -156,7 +156,7 @@ typedef struct coproc_operations struct module *owner; int (*open) (void *devc, int sub_device); void (*close) (void *devc, int sub_device); - int (*ioctl) (void *devc, unsigned int cmd, caddr_t arg, int local); + int (*ioctl) (void *devc, unsigned int cmd, void __user * arg, int local); void (*reset) (void *devc); void *devc; /* Driver specific info */ @@ -171,14 +171,14 @@ struct audio_driver int count, int intrflag); void (*start_input) (int dev, unsigned long buf, int count, int intrflag); - int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); + int (*ioctl) (int dev, unsigned int cmd, void __user * arg); int (*prepare_for_input) (int dev, int bufsize, int nbufs); int (*prepare_for_output) (int dev, int bufsize, int nbufs); void (*halt_io) (int dev); int (*local_qlen)(int dev); void (*copy_user) (int dev, char *localbuf, int localoffs, - const char *userbuf, int useroffs, + const char __user *userbuf, int useroffs, int max_in, int max_out, int *used, int *returned, int len); @@ -247,7 +247,7 @@ struct mixer_operations struct module *owner; char id[16]; char name[64]; - int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); + int (*ioctl) (int dev, unsigned int cmd, void __user * arg); void *devc; int modify_counter; @@ -264,13 +264,13 @@ struct synth_operations int (*open) (int dev, int mode); void (*close) (int dev); - int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); + int (*ioctl) (int dev, unsigned int cmd, void __user * arg); int (*kill_note) (int dev, int voice, int note, int velocity); int (*start_note) (int dev, int voice, int note, int velocity); int (*set_instr) (int dev, int voice, int instr); void (*reset) (int dev); void (*hw_control) (int dev, unsigned char *event); - int (*load_patch) (int dev, int format, const char *addr, + int (*load_patch) (int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag); void (*aftertouch) (int dev, int voice, int pressure); void (*controller) (int dev, int voice, int ctrl_num, int value); @@ -317,7 +317,7 @@ struct midi_operations void (*outputintr)(int dev) ); void (*close) (int dev); - int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); + int (*ioctl) (int dev, unsigned int cmd, void __user * arg); int (*outputc) (int dev, unsigned char data); int (*start_read) (int dev); int (*end_read) (int dev); @@ -348,7 +348,7 @@ struct sound_timer_operations void (*close)(int dev); int (*event)(int dev, unsigned char *ev); unsigned long (*get_time)(int dev); - int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); + int (*ioctl) (int dev, unsigned int cmd, void __user * arg); void (*arm_timer)(int dev, long time); }; diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c index 73aa1903181559..c601ea25ec48cc 100644 --- a/sound/oss/dmabuf.c +++ b/sound/oss/dmabuf.c @@ -236,7 +236,7 @@ static unsigned int default_set_bits(int dev, unsigned int bits) mm_segment_t fs = get_fs(); set_fs(get_ds()); - audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SETFMT, (caddr_t)&bits); + audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SETFMT, (void __user *)&bits); set_fs(fs); return bits; } @@ -246,7 +246,7 @@ static int default_set_speed(int dev, int speed) mm_segment_t fs = get_fs(); set_fs(get_ds()); - audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SPEED, (caddr_t)&speed); + audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SPEED, (void __user *)&speed); set_fs(fs); return speed; } @@ -257,7 +257,7 @@ static short default_set_channels(int dev, short channels) mm_segment_t fs = get_fs(); set_fs(get_ds()); - audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_CHANNELS, (caddr_t)&c); + audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_CHANNELS, (void __user *)&c); set_fs(fs); return c; } diff --git a/sound/oss/gus.h b/sound/oss/gus.h index 45b60fac1014b0..3d5271baf042f0 100644 --- a/sound/oss/gus.h +++ b/sound/oss/gus.h @@ -13,7 +13,7 @@ void gus_voice_irq(void); void gus_write8(int reg, unsigned int data); void guswave_dma_irq(void); void gus_delay(void); -int gus_default_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg); +int gus_default_mixer_ioctl (int dev, unsigned int cmd, void __user *arg); void gus_timer_command (unsigned int addr, unsigned int val); /* From gus_midi.c */ diff --git a/sound/oss/gus_wave.c b/sound/oss/gus_wave.c index 1aadc7e6894cc6..35ade6b85b1986 100644 --- a/sound/oss/gus_wave.c +++ b/sound/oss/gus_wave.c @@ -1045,7 +1045,7 @@ int __init gus_wave_detect(int baseaddr) return 1; } -static int guswave_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int guswave_ioctl(int dev, unsigned int cmd, void __user *arg) { switch (cmd) @@ -1622,7 +1622,7 @@ static void guswave_close(int dev) DMAbuf_close_dma(gus_devnum); } -static int guswave_load_patch(int dev, int format, const char *addr, +static int guswave_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { struct patch_info patch; @@ -1780,7 +1780,7 @@ static int guswave_load_patch(int dev, int format, const char *addr, for (i = 0; i < blk_sz; i++) { - get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[sizeof_patch + i])); + get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[sizeof_patch + i])); if (patch.mode & WAVE_UNSIGNED) if (!(patch.mode & WAVE_16_BITS) || (i & 0x01)) data ^= 0x80; /* Convert to signed */ @@ -2082,14 +2082,14 @@ static int gus_audio_set_bits(int bits) return bits; } -static int gus_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int gus_audio_ioctl(int dev, unsigned int cmd, void __user *arg) { int val; switch (cmd) { case SOUND_PCM_WRITE_RATE: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user*)arg)) return -EFAULT; val = gus_audio_set_speed(val); break; @@ -2099,13 +2099,13 @@ static int gus_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = gus_audio_set_channels(val + 1) - 1; break; case SOUND_PCM_WRITE_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = gus_audio_set_channels(val); break; @@ -2115,7 +2115,7 @@ static int gus_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = gus_audio_set_bits(val); break; @@ -2131,7 +2131,7 @@ static int gus_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } static void gus_audio_reset(int dev) @@ -2687,19 +2687,19 @@ static void set_input_volumes(void) #define MIX_DEVS (SOUND_MASK_MIC|SOUND_MASK_LINE| \ SOUND_MASK_SYNTH|SOUND_MASK_PCM) -int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +int gus_default_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { int vol, val; if (((cmd >> 8) & 0xff) != 'M') return -EINVAL; - if (!access_ok(VERIFY_WRITE, (int *)arg, sizeof(int))) + if (!access_ok(VERIFY_WRITE, arg, sizeof(int))) return -EFAULT; if (_SIOC_DIR(cmd) & _SIOC_WRITE) { - if (__get_user(val, (int *) arg)) + if (__get_user(val, (int __user *) arg)) return -EFAULT; switch (cmd & 0xff) @@ -2810,7 +2810,7 @@ int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) return -EINVAL; } } - return __put_user(val, (int *)arg); + return __put_user(val, (int __user *)arg); } static struct mixer_operations gus_mixer_operations = diff --git a/sound/oss/ics2101.c b/sound/oss/ics2101.c index 5c633dd6a55259..d5f3be8550f34e 100644 --- a/sound/oss/ics2101.c +++ b/sound/oss/ics2101.c @@ -117,14 +117,14 @@ static int set_volumes(int dev, int vol) return vol; } -static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int ics2101_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { int val; if (((cmd >> 8) & 0xff) == 'M') { if (_SIOC_DIR(cmd) & _SIOC_WRITE) { - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: @@ -153,7 +153,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } else { switch (cmd & 0xff) { /* @@ -201,7 +201,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } } return -EINVAL; diff --git a/sound/oss/maui.c b/sound/oss/maui.c index dd5f8437a26d7c..1de0fb55bcfed0 100644 --- a/sound/oss/maui.c +++ b/sound/oss/maui.c @@ -53,7 +53,7 @@ static int *maui_osp; #define STAT_RX_AVAIL 0x02 #define STAT_RX_IENA 0x01 -static int (*orig_load_patch) (int dev, int format, const char *addr, +static int (*orig_load_patch)(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) = NULL; #include "maui_boot.h" @@ -242,7 +242,7 @@ static int maui_short_wait(int mask) { return 0; } -static int maui_load_patch(int dev, int format, const char *addr, +static int maui_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { @@ -282,7 +282,7 @@ static int maui_load_patch(int dev, int format, const char *addr, for (i = 0; i < left; i++) { unsigned char data; - if(get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[hdr_size + i]))) + if(get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i]))) return -EFAULT; if (i == 0 && !(data & 0x80)) return -EINVAL; diff --git a/sound/oss/midi_synth.c b/sound/oss/midi_synth.c index 4336627c92a23d..972edc62afd10d 100644 --- a/sound/oss/midi_synth.c +++ b/sound/oss/midi_synth.c @@ -256,7 +256,7 @@ midi_synth_output(int dev) */ } -int midi_synth_ioctl(int dev, unsigned int cmd, caddr_t arg) +int midi_synth_ioctl(int dev, unsigned int cmd, void __user *arg) { /* * int orig_dev = synth_devs[dev]->midi_dev; @@ -466,7 +466,7 @@ midi_synth_hw_control(int dev, unsigned char *event) } int -midi_synth_load_patch(int dev, int format, const char *addr, +midi_synth_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { int orig_dev = synth_devs[dev]->midi_dev; @@ -514,7 +514,7 @@ midi_synth_load_patch(int dev, int format, const char *addr, { unsigned char data; - get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[hdr_size + i])); + get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i])); eox_seen = (i > 0 && data & 0x80); /* End of sysex */ diff --git a/sound/oss/midi_synth.h b/sound/oss/midi_synth.h index fcaf7d53e2457c..6bc9d00bc77c47 100644 --- a/sound/oss/midi_synth.h +++ b/sound/oss/midi_synth.h @@ -1,5 +1,5 @@ int midi_synth_ioctl (int dev, - unsigned int cmd, caddr_t arg); + unsigned int cmd, void __user * arg); int midi_synth_kill_note (int dev, int channel, int note, int velocity); int midi_synth_set_instr (int dev, int channel, int instr_no); int midi_synth_start_note (int dev, int channel, int note, int volume); @@ -7,7 +7,7 @@ void midi_synth_reset (int dev); int midi_synth_open (int dev, int mode); void midi_synth_close (int dev); void midi_synth_hw_control (int dev, unsigned char *event); -int midi_synth_load_patch (int dev, int format, const char * addr, +int midi_synth_load_patch (int dev, int format, const char __user * addr, int offs, int count, int pmgr_flag); void midi_synth_panning (int dev, int channel, int pressure); void midi_synth_aftertouch (int dev, int channel, int pressure); diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c index 1b917961001130..615b5c8c7bf507 100644 --- a/sound/oss/midibuf.c +++ b/sound/oss/midibuf.c @@ -256,7 +256,7 @@ void MIDIbuf_release(int dev, struct file *file) module_put(midi_devs[dev]->owner); } -int MIDIbuf_write(int dev, struct file *file, const char *buf, int count) +int MIDIbuf_write(int dev, struct file *file, const char __user *buf, int count) { int c, n, i; unsigned char tmp_data; @@ -310,7 +310,7 @@ out: } -int MIDIbuf_read(int dev, struct file *file, char *buf, int count) +int MIDIbuf_read(int dev, struct file *file, char __user *buf, int count) { int n, c = 0; unsigned char tmp_data; @@ -359,7 +359,7 @@ out: } int MIDIbuf_ioctl(int dev, struct file *file, - unsigned int cmd, caddr_t arg) + unsigned int cmd, void __user *arg) { int val; @@ -377,13 +377,13 @@ int MIDIbuf_ioctl(int dev, struct file *file, switch (cmd) { case SNDCTL_MIDI_PRETIME: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; if (val < 0) val = 0; val = (HZ * val) / 10; parms[dev].prech_timeout = val; - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); default: if (!midi_devs[dev]->ioctl) diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c index 0059ee08d3b0b4..341983bff7b76d 100644 --- a/sound/oss/mpu401.c +++ b/sound/oss/mpu401.c @@ -728,7 +728,7 @@ static int mpu401_end_read(int dev) return 0; } -static int mpu401_ioctl(int dev, unsigned cmd, caddr_t arg) +static int mpu401_ioctl(int dev, unsigned cmd, void __user *arg) { struct mpu_config *devc; mpu_command_rec rec; @@ -742,7 +742,7 @@ static int mpu401_ioctl(int dev, unsigned cmd, caddr_t arg) printk(KERN_WARNING "mpu401: Intelligent mode not supported by the HW\n"); return -EINVAL; } - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; set_uart_mode(dev, devc, !val); return 0; @@ -772,8 +772,7 @@ static int mpu401_buffer_status(int dev) */ } -static int mpu_synth_ioctl(int dev, - unsigned int cmd, caddr_t arg) +static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg) { int midi_dev; struct mpu_config *devc; @@ -789,8 +788,7 @@ static int mpu_synth_ioctl(int dev, { case SNDCTL_SYNTH_INFO: - if (copy_to_user((&((char *) arg)[0]), - (char *) &mpu_synth_info[midi_dev], + if (copy_to_user(arg, &mpu_synth_info[midi_dev], sizeof(struct synth_info))) return -EFAULT; return 0; @@ -1508,17 +1506,19 @@ static unsigned long mpu_timer_get_time(int dev) return curr_ticks; } -static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg) +static int mpu_timer_ioctl(int dev, unsigned int command, void __user *arg) { int midi_dev = sound_timer_devs[dev]->devlink; + int __user *p = (int __user *)arg; switch (command) { case SNDCTL_TMR_SOURCE: { int parm; - - parm = *(int *) arg; + + if (get_user(parm, p)) + return -EFAULT; parm &= timer_caps; if (parm != 0) @@ -1530,7 +1530,9 @@ static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg) else if (timer_mode & TMR_MODE_SMPTE) mpu_cmd(midi_dev, 0x3d, 0); /* Use SMPTE sync */ } - return (*(int *) arg = timer_mode); + if (put_user(timer_mode, p)) + return -EFAULT; + return timer_mode; } break; @@ -1554,11 +1556,13 @@ static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg) case SNDCTL_TMR_TIMEBASE: { int val; - - val = *(int *) arg; + if (get_user(val, p)) + return -EFAULT; if (val) set_timebase(midi_dev, val); - return (*(int *) arg = curr_timebase); + if (put_user(curr_timebase, p)) + return -EFAULT; + return curr_timebase; } break; @@ -1567,7 +1571,8 @@ static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg) int val; int ret; - val = *(int *) arg; + if (get_user(val, p)) + return -EFAULT; if (val) { @@ -1582,26 +1587,35 @@ static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg) } curr_tempo = val; } - return (*(int *) arg = curr_tempo); + if (put_user(curr_tempo, p)) + return -EFAULT; + return curr_tempo; } break; case SNDCTL_SEQ_CTRLRATE: { int val; + if (get_user(val, p)) + return -EFAULT; - val = *(int *) arg; if (val != 0) /* Can't change */ return -EINVAL; - return (*(int *) arg = ((curr_tempo * curr_timebase) + 30) / 60); + val = ((curr_tempo * curr_timebase) + 30)/60; + if (put_user(val, p)) + return -EFAULT; + return val; } break; case SNDCTL_SEQ_GETTIME: - return (*(int *) arg = curr_ticks); + if (put_user(curr_ticks, p)) + return -EFAULT; + return curr_ticks; case SNDCTL_TMR_METRONOME: - metronome_mode = *(int *) arg; + if (get_user(metronome_mode, p)) + return -EFAULT; setup_metronome(midi_dev); return 0; diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c index 5cdea9d107fe94..ca763f8e71b773 100644 --- a/sound/oss/nm256_audio.c +++ b/sound/oss/nm256_audio.c @@ -929,7 +929,7 @@ nm256_resetAC97 (struct ac97_hwint *dev) * mixer ioctl to the AC97 driver. */ static int -nm256_default_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) +nm256_default_mixer_ioctl (int dev, unsigned int cmd, void __user *arg) { struct nm256_info *card = nm256_find_card_for_mixer (dev); if (card != NULL) @@ -1418,7 +1418,7 @@ nm256_audio_close(int dev) /* Standard ioctl handler. */ static int -nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) +nm256_audio_ioctl(int dev, unsigned int cmd, void __user *arg) { int ret; u32 oldinfo; @@ -1442,7 +1442,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) switch (cmd) { case SOUND_PCM_WRITE_RATE: - if (get_user(ret, (int *) arg)) + if (get_user(ret, (int __user *) arg)) return -EFAULT; if (ret != 0) { @@ -1461,7 +1461,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_STEREO: - if (get_user(ret, (int *) arg)) + if (get_user(ret, (int __user *) arg)) return -EFAULT; card->sinfo[w].stereo = ret ? 1 : 0; @@ -1472,7 +1472,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SOUND_PCM_WRITE_CHANNELS: - if (get_user(ret, (int *) arg)) + if (get_user(ret, (int __user *) arg)) return -EFAULT; if (ret < 1 || ret > 3) @@ -1490,7 +1490,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_SETFMT: - if (get_user(ret, (int *) arg)) + if (get_user(ret, (int __user *) arg)) return -EFAULT; if (ret != 0) { @@ -1511,7 +1511,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(ret, (int *) arg); + return put_user(ret, (int __user *) arg); } /* diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index cc9ce47312c09c..c69c135a949c00 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c @@ -110,7 +110,7 @@ static void enter_4op_mode(void) devc->v_alloc->max_voice = devc->nr_voice = 12; } -static int opl3_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int opl3_ioctl(int dev, unsigned int cmd, void __user * arg) { struct sbi_instrument ins; diff --git a/sound/oss/opl3sa2.c b/sound/oss/opl3sa2.c index 6057e071a3ac03..6daba626e22022 100644 --- a/sound/oss/opl3sa2.c +++ b/sound/oss/opl3sa2.c @@ -389,9 +389,10 @@ static inline int ret_vol_stereo(int left, int right) } -static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { int retval, value, cmdf = cmd & 0xff; + int __user *p = (int __user *)arg; opl3sa2_state_t* devc = &opl3sa2_state[dev]; @@ -416,23 +417,23 @@ static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) if (_SIOC_DIR (cmd) & _SIOC_WRITE) { switch (cmdf) { case SOUND_MIXER_VOLUME: - retval = get_user(value, (unsigned int *) arg); + retval = get_user(value, (unsigned __user *) arg); if (retval) break; arg_to_vol_stereo(value, &devc->volume_l, &devc->volume_r); opl3sa2_set_volume(devc, devc->volume_l, devc->volume_r); value = ret_vol_stereo(devc->volume_l, devc->volume_r); - retval = put_user(value, (int *) arg); + retval = put_user(value, p); break; case SOUND_MIXER_MIC: - retval = get_user(value, (unsigned int *) arg); + retval = get_user(value, (unsigned __user *) arg); if (retval) break; arg_to_vol_mono(value, &devc->mic); opl3sa2_set_mic(devc, devc->mic); value = ret_vol_mono(devc->mic); - retval = put_user(value, (int *) arg); + retval = put_user(value, p); break; default: @@ -445,35 +446,35 @@ static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) */ switch (cmdf) { case SOUND_MIXER_DEVMASK: - retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, (int *) arg); + retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, p); break; case SOUND_MIXER_STEREODEVS: - retval = put_user(SOUND_MASK_VOLUME, (int *) arg); + retval = put_user(SOUND_MASK_VOLUME, p); break; case SOUND_MIXER_RECMASK: /* No recording devices */ - retval = put_user(0, (int *) arg); + retval = put_user(0, p); break; case SOUND_MIXER_CAPS: - retval = put_user(SOUND_CAP_EXCL_INPUT, (int *) arg); + retval = put_user(SOUND_CAP_EXCL_INPUT, p); break; case SOUND_MIXER_RECSRC: /* No recording source */ - retval = put_user(0, (int *) arg); + retval = put_user(0, p); break; case SOUND_MIXER_VOLUME: value = ret_vol_stereo(devc->volume_l, devc->volume_r); - retval = put_user(value, (int *) arg); + retval = put_user(value, p); break; case SOUND_MIXER_MIC: value = ret_vol_mono(devc->mic); - put_user(value, (int *) arg); + put_user(value, p); break; default: @@ -485,7 +486,7 @@ static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) /* opl3sa2_mixer_ioctl end */ -static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, void __user * arg) { int value, retval, cmdf = cmd & 0xff; @@ -494,17 +495,17 @@ static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) switch (cmdf) { case SOUND_MIXER_BASS: value = ret_vol_stereo(devc->bass_l, devc->bass_r); - retval = put_user(value, (int *) arg); + retval = put_user(value, (int __user *) arg); break; case SOUND_MIXER_TREBLE: value = ret_vol_stereo(devc->treble_l, devc->treble_r); - retval = put_user(value, (int *) arg); + retval = put_user(value, (int __user *) arg); break; case SOUND_MIXER_DIGITAL1: value = ret_vol_stereo(devc->wide_l, devc->wide_r); - retval = put_user(value, (int *) arg); + retval = put_user(value, (int __user *) arg); break; default: diff --git a/sound/oss/os.h b/sound/oss/os.h index 772d4bc145c173..d6b96297835ca8 100644 --- a/sound/oss/os.h +++ b/sound/oss/os.h @@ -42,7 +42,7 @@ extern void reprogram_timer(void); #define USE_AUTOINIT_DMA -extern caddr_t sound_mem_blocks[1024]; +extern void *sound_mem_blocks[1024]; extern int sound_nblocks; #undef PSEUDO_DMA_AUTOINIT diff --git a/sound/oss/pas2_mixer.c b/sound/oss/pas2_mixer.c index 57d95d7ec43319..4aade530458743 100644 --- a/sound/oss/pas2_mixer.c +++ b/sound/oss/pas2_mixer.c @@ -215,13 +215,14 @@ pas_mixer_reset(void) set_mode(0x04 | 0x01); } -static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int pas_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { int level,v ; + int __user *p = (int __user *)arg; DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg)); if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */ - if (get_user(level, (int *)arg)) + if (get_user(level, p)) return -EFAULT; if (level == -1) /* Return current settings */ level = (mode_control & 0x04); @@ -232,10 +233,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) set_mode(mode_control); } level = !!level; - return put_user(level, (int *)arg); + return put_user(level, p); } if (cmd == SOUND_MIXER_PRIVATE2) { /* Set enhance bit */ - if (get_user(level, (int *)arg)) + if (get_user(level, p)) return -EFAULT; if (level == -1) { /* Return current settings */ if (!(mode_control & 0x03)) @@ -255,10 +256,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) i = (i + 1) * 20; level = i; } - return put_user(level, (int *)arg); + return put_user(level, p); } if (cmd == SOUND_MIXER_PRIVATE3) { /* Set mute bit */ - if (get_user(level, (int *)arg)) + if (get_user(level, p)) return -EFAULT; if (level == -1) /* Return current settings */ level = !(pas_read(0x0B8A) & 0x20); @@ -270,10 +271,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) level = !(pas_read(0x0B8A) & 0x20); } - return put_user(level, (int *)arg); + return put_user(level, p); } if (((cmd >> 8) & 0xff) == 'M') { - if (get_user(v, (int *)arg)) + if (get_user(v, p)) return -EFAULT; if (_SIOC_DIR(cmd) & _SIOC_WRITE) { v = pas_mixer_set(cmd & 0xff, v); @@ -304,7 +305,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) break; } } - return put_user(v, (int *)arg); + return put_user(v, p); } return -EINVAL; } diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c index e968659232cbfa..4af6aafa3d8623 100644 --- a/sound/oss/pas2_pcm.c +++ b/sound/oss/pas2_pcm.c @@ -151,16 +151,17 @@ static int pcm_set_bits(int arg) return pcm_bits; } -static int pas_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg) { int val, ret; + int __user *p = arg; DEB(printk("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg)); switch (cmd) { case SOUND_PCM_WRITE_RATE: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; ret = pcm_set_speed(val); break; @@ -170,13 +171,13 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; ret = pcm_set_channels(val + 1) - 1; break; case SOUND_PCM_WRITE_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; ret = pcm_set_channels(val); break; @@ -186,7 +187,7 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; ret = pcm_set_bits(val); break; @@ -198,7 +199,7 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(ret, (int *)arg); + return put_user(ret, p); } static void pas_audio_reset(int dev) diff --git a/sound/oss/pss.c b/sound/oss/pss.c index 9a1c915809c180..38019143b20826 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c @@ -453,20 +453,36 @@ static void pss_mixer_reset(pss_confdata *devc) } } -static void arg_to_volume_mono(unsigned int volume, int *aleft) +static int set_volume_mono(unsigned __user *p, int *aleft) { int left; + unsigned volume; + if (get_user(volume, p)) + return -EFAULT; - left = volume & 0x00ff; + left = volume & 0xff; if (left > 100) left = 100; *aleft = left; + return 0; } -static void arg_to_volume_stereo(unsigned int volume, int *aleft, int *aright) +static int set_volume_stereo(unsigned __user *p, int *aleft, int *aright) { - arg_to_volume_mono(volume, aleft); - arg_to_volume_mono(volume >> 8, aright); + int left, right; + unsigned volume; + if (get_user(volume, p)) + return -EFAULT; + + left = volume & 0xff; + if (left > 100) + left = 100; + right = (volume >> 8) & 0xff; + if (right > 100) + right = 100; + *aleft = left; + *aright = right; + return 0; } static int ret_vol_mono(int left) @@ -479,7 +495,7 @@ static int ret_vol_stereo(int left, int right) return ((right << 8) | left); } -static int call_ad_mixer(pss_confdata *devc,unsigned int cmd, caddr_t arg) +static int call_ad_mixer(pss_confdata *devc,unsigned int cmd, void __user *arg) { if (devc->ad_mixer_dev != NO_WSS_MIXER) return mixer_devs[devc->ad_mixer_dev]->ioctl(devc->ad_mixer_dev, cmd, arg); @@ -487,7 +503,7 @@ static int call_ad_mixer(pss_confdata *devc,unsigned int cmd, caddr_t arg) return -EINVAL; } -static int pss_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) +static int pss_mixer_ioctl (int dev, unsigned int cmd, void __user *arg) { pss_confdata *devc = mixer_devs[dev]->devc; int cmdf = cmd & 0xff; @@ -513,33 +529,38 @@ static int pss_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) return call_ad_mixer(devc, cmd, arg); else { - if (*(int *)arg != 0) + int v; + if (get_user(v, (int __user *)arg)) + return -EFAULT; + if (v != 0) return -EINVAL; return 0; } case SOUND_MIXER_VOLUME: - arg_to_volume_stereo(*(unsigned int *)arg, &devc->mixer.volume_l, - &devc->mixer.volume_r); + if (set_volume_stereo(arg, + &devc->mixer.volume_l, + &devc->mixer.volume_r)) + return -EFAULT; set_master_volume(devc, devc->mixer.volume_l, devc->mixer.volume_r); return ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r); case SOUND_MIXER_BASS: - arg_to_volume_mono(*(unsigned int *)arg, - &devc->mixer.bass); + if (set_volume_mono(arg, &devc->mixer.bass)) + return -EFAULT; set_bass(devc, devc->mixer.bass); return ret_vol_mono(devc->mixer.bass); case SOUND_MIXER_TREBLE: - arg_to_volume_mono(*(unsigned int *)arg, - &devc->mixer.treble); + if (set_volume_mono(arg, &devc->mixer.treble)) + return -EFAULT; set_treble(devc, devc->mixer.treble); return ret_vol_mono(devc->mixer.treble); case SOUND_MIXER_SYNTH: - arg_to_volume_mono(*(unsigned int *)arg, - &devc->mixer.synth); + if (set_volume_mono(arg, &devc->mixer.synth)) + return -EFAULT; set_synth_volume(devc, devc->mixer.synth); return ret_vol_mono(devc->mixer.synth); @@ -549,54 +570,67 @@ static int pss_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) } else { + int val, and_mask = 0, or_mask = 0; /* * Return parameters */ switch (cmdf) { - case SOUND_MIXER_DEVMASK: if (call_ad_mixer(devc, cmd, arg) == -EINVAL) - *(int *)arg = 0; /* no mixer devices */ - return (*(int *)arg |= SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE | SOUND_MASK_SYNTH); + break; + and_mask = ~0; + or_mask = SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE | SOUND_MASK_SYNTH; + break; case SOUND_MIXER_STEREODEVS: if (call_ad_mixer(devc, cmd, arg) == -EINVAL) - *(int *)arg = 0; /* no stereo devices */ - return (*(int *)arg |= SOUND_MASK_VOLUME); + break; + and_mask = ~0; + or_mask = SOUND_MASK_VOLUME; + break; case SOUND_MIXER_RECMASK: if (devc->ad_mixer_dev != NO_WSS_MIXER) return call_ad_mixer(devc, cmd, arg); - else - return (*(int *)arg = 0); /* no record devices */ + break; case SOUND_MIXER_CAPS: if (devc->ad_mixer_dev != NO_WSS_MIXER) return call_ad_mixer(devc, cmd, arg); - else - return (*(int *)arg = SOUND_CAP_EXCL_INPUT); + or_mask = SOUND_CAP_EXCL_INPUT; + break; case SOUND_MIXER_RECSRC: if (devc->ad_mixer_dev != NO_WSS_MIXER) return call_ad_mixer(devc, cmd, arg); - else - return (*(int *)arg = 0); /* no record source */ + break; case SOUND_MIXER_VOLUME: - return (*(int *)arg = ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r)); + or_mask = ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r); + break; case SOUND_MIXER_BASS: - return (*(int *)arg = ret_vol_mono(devc->mixer.bass)); + or_mask = ret_vol_mono(devc->mixer.bass); + break; case SOUND_MIXER_TREBLE: - return (*(int *)arg = ret_vol_mono(devc->mixer.treble)); + or_mask = ret_vol_mono(devc->mixer.treble); + break; case SOUND_MIXER_SYNTH: - return (*(int *)arg = ret_vol_mono(devc->mixer.synth)); + or_mask = ret_vol_mono(devc->mixer.synth); + break; default: return -EINVAL; } + if (get_user(val, (int __user *)arg)) + return -EFAULT; + val &= and_mask; + val |= or_mask; + if (put_user(val, (int __user *)arg)) + return -EFAULT; + return val; } } @@ -803,7 +837,7 @@ static int download_boot_block(void *dev_info, copr_buffer * buf) return 0; } -static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, caddr_t arg, int local) +static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local) { copr_buffer *buf; copr_msg *mbuf; diff --git a/sound/oss/sb_midi.c b/sound/oss/sb_midi.c index 449357eec55b86..ed3bd0640ffd4e 100644 --- a/sound/oss/sb_midi.c +++ b/sound/oss/sb_midi.c @@ -118,7 +118,7 @@ static int sb_midi_end_read(int dev) return 0; } -static int sb_midi_ioctl(int dev, unsigned cmd, caddr_t arg) +static int sb_midi_ioctl(int dev, unsigned cmd, void __user *arg) { return -EINVAL; } diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index 4e83b586aa06e9..f56898c3981e00 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c @@ -528,10 +528,11 @@ static int set_outmask(sb_devc * devc, int mask) return devc->outmask; } -static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int sb_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { sb_devc *devc = mixer_devs[dev]->devc; int val, ret; + int __user *p = arg; /* * Use ioctl(fd, SOUND_MIXER_AGC, &mode) to turn AGC off (0) or on (1). @@ -541,7 +542,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) if (devc->model == MDL_SB16) { if (cmd == SOUND_MIXER_AGC) { - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; sb_setmixer(devc, 0x43, (~val) & 0x01); return 0; @@ -552,14 +553,14 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) At least my 4.13 havn't 3DSE, 4.16 has it. */ if (devc->minor < 15) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val == 0 || val == 1) sb_chgmixer(devc, AWE_3DSE, 0x01, val); else if (val == 2) { ret = sb_getmixer(devc, AWE_3DSE)&0x01; - return put_user(ret, (int *)arg); + return put_user(ret, p); } else return -EINVAL; @@ -570,7 +571,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) { if (_SIOC_DIR(cmd) & _SIOC_WRITE) { - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; switch (cmd & 0xff) { @@ -625,7 +626,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ret = sb_mixer_get(devc, cmd & 0xff); break; } - return put_user(ret, (int *)arg); + return put_user(ret, p); } else return -EINVAL; } diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 04f334edf4b9e7..038bf7fd31eae7 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c @@ -82,7 +82,7 @@ static void seq_reset(void); #error Too many synthesizer devices enabled. #endif -int sequencer_read(int dev, struct file *file, char *buf, int count) +int sequencer_read(int dev, struct file *file, char __user *buf, int count) { int c = count, p = 0; int ev_len; @@ -207,7 +207,7 @@ void seq_input_event(unsigned char *event_rec, int len) seq_copy_to_input(event_rec, len); } -int sequencer_write(int dev, struct file *file, const char *buf, int count) +int sequencer_write(int dev, struct file *file, const char __user *buf, int count) { unsigned char event_rec[EV_SZ], ev_code; int p = 0, c, ev_size; @@ -1320,13 +1320,14 @@ static void seq_panic(void) */ } -int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) +int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, void __user *arg) { int midi_dev, orig_dev, val, err; int mode = translate_mode(file); struct synth_info inf; struct seq_event_rec event_rec; unsigned long flags; + int __user *p = arg; orig_dev = dev = dev >> 4; @@ -1346,7 +1347,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) case SNDCTL_TMR_SELECT: if (seq_mode != SEQ_2) return -EINVAL; - if (get_user(pending_timer, (int *)arg)) + if (get_user(pending_timer, p)) return -EFAULT; if (pending_timer < 0 || pending_timer >= num_sound_timers || sound_timer_devs[pending_timer] == NULL) { @@ -1372,7 +1373,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_SEQ_TESTMIDI: - if (__get_user(midi_dev, (int *)arg)) + if (__get_user(midi_dev, p)) return -EFAULT; if (midi_dev < 0 || midi_dev >= max_mididev || !midi_devs[midi_dev]) return -ENXIO; @@ -1409,7 +1410,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) if (seq_mode == SEQ_2) return tmr->ioctl(tmr_no, cmd, arg); - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) return -EINVAL; @@ -1419,7 +1420,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) case SNDCTL_SEQ_RESETSAMPLES: case SNDCTL_SYNTH_REMOVESAMPLE: case SNDCTL_SYNTH_CONTROL: - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL) return -ENXIO; @@ -1436,7 +1437,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SNDCTL_SYNTH_MEMAVL: - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL) return -ENXIO; @@ -1446,7 +1447,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) break; case SNDCTL_FM_4OP_ENABLE: - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL) return -ENXIO; @@ -1456,7 +1457,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_SYNTH_INFO: - if (get_user(dev, (int *)(&(((struct synth_info *)arg)->device)))) + if (get_user(dev, &((struct synth_info __user *)arg)->device)) return -EFAULT; if (dev < 0 || dev >= max_synthdev) return -ENXIO; @@ -1466,7 +1467,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) /* Like SYNTH_INFO but returns ID in the name field */ case SNDCTL_SYNTH_ID: - if (get_user(dev, (int *)(&(((struct synth_info *)arg)->device)))) + if (get_user(dev, &((struct synth_info __user *)arg)->device)) return -EFAULT; if (dev < 0 || dev >= max_synthdev) return -ENXIO; @@ -1486,7 +1487,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_MIDI_INFO: - if (get_user(dev, (int *)(&(((struct midi_info *)arg)->device)))) + if (get_user(dev, &((struct midi_info __user *)arg)->device)) return -EFAULT; if (dev < 0 || dev >= max_mididev || !midi_devs[dev]) return -ENXIO; @@ -1494,7 +1495,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return copy_to_user(arg, &midi_devs[dev]->info, sizeof(struct midi_info))?-EFAULT:0; case SNDCTL_SEQ_THRESHOLD: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 1) val = 1; @@ -1504,7 +1505,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_MIDI_PRETIME: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 0) val = 0; @@ -1523,7 +1524,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg) return -EINVAL; return synth_devs[0]->ioctl(0, cmd, arg); } - return put_user(val, (int *)arg); + return put_user(val, p); } /* No kernel lock - we're using the global irq lock here */ diff --git a/sound/oss/sound_calls.h b/sound/oss/sound_calls.h index ffa0c1caf3ce3d..7914e51a89d525 100644 --- a/sound/oss/sound_calls.h +++ b/sound/oss/sound_calls.h @@ -9,7 +9,7 @@ int DMAbuf_getrdbuffer(int dev, char **buf, int *len, int dontblock); int DMAbuf_rmchars(int dev, int buff_no, int c); int DMAbuf_start_output(int dev, int buff_no, int l); int DMAbuf_move_wrpointer(int dev, int l); -/* int DMAbuf_ioctl(int dev, unsigned int cmd, caddr_t arg, int local); */ +/* int DMAbuf_ioctl(int dev, unsigned int cmd, void __user *arg, int local); */ void DMAbuf_init(int dev, int dma1, int dma2); void DMAbuf_deinit(int dev); int DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode); @@ -31,25 +31,25 @@ int DMAbuf_sync (int dev); * System calls for /dev/dsp and /dev/audio (audio.c) */ -int audio_read (int dev, struct file *file, char *buf, int count); -int audio_write (int dev, struct file *file, const char *buf, int count); +int audio_read (int dev, struct file *file, char __user *buf, int count); +int audio_write (int dev, struct file *file, const char __user *buf, int count); int audio_open (int dev, struct file *file); void audio_release (int dev, struct file *file); int audio_ioctl (int dev, struct file *file, - unsigned int cmd, caddr_t arg); + unsigned int cmd, void __user *arg); void audio_init_devices (void); void reorganize_buffers (int dev, struct dma_buffparms *dmap, int recording); -int dma_ioctl (int dev, unsigned int cmd, caddr_t arg); +int dma_ioctl (int dev, unsigned int cmd, void __user *arg); /* * System calls for the /dev/sequencer */ -int sequencer_read (int dev, struct file *file, char *buf, int count); -int sequencer_write (int dev, struct file *file, const char *buf, int count); +int sequencer_read (int dev, struct file *file, char __user *buf, int count); +int sequencer_write (int dev, struct file *file, const char __user *buf, int count); int sequencer_open (int dev, struct file *file); void sequencer_release (int dev, struct file *file); -int sequencer_ioctl (int dev, struct file *file, unsigned int cmd, caddr_t arg); +int sequencer_ioctl (int dev, struct file *file, unsigned int cmd, void __user *arg); unsigned int sequencer_poll(int dev, struct file *file, poll_table * wait); void sequencer_init (void); @@ -65,11 +65,11 @@ void seq_copy_to_input (unsigned char *event, int len); * System calls for the /dev/midi */ -int MIDIbuf_read (int dev, struct file *file, char *buf, int count); -int MIDIbuf_write (int dev, struct file *file, const char *buf, int count); +int MIDIbuf_read (int dev, struct file *file, char __user *buf, int count); +int MIDIbuf_write (int dev, struct file *file, const char __user *buf, int count); int MIDIbuf_open (int dev, struct file *file); void MIDIbuf_release (int dev, struct file *file); -int MIDIbuf_ioctl (int dev, struct file *file, unsigned int cmd, caddr_t arg); +int MIDIbuf_ioctl (int dev, struct file *file, unsigned int cmd, void __user *arg); unsigned int MIDIbuf_poll(int dev, struct file *file, poll_table * wait); int MIDIbuf_avail(int dev); diff --git a/sound/oss/sound_timer.c b/sound/oss/sound_timer.c index 15dc6adf1c891d..bc2777dd2ef9c3 100644 --- a/sound/oss/sound_timer.c +++ b/sound/oss/sound_timer.c @@ -177,8 +177,9 @@ static unsigned long timer_get_time(int dev) return curr_ticks; } -static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int timer_ioctl(int dev, unsigned int cmd, void __user *arg) { + int __user *p = arg; int val; switch (cmd) @@ -201,7 +202,7 @@ static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_TMR_TIMEBASE: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val) { @@ -215,7 +216,7 @@ static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_TMR_TEMPO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val) { @@ -233,7 +234,7 @@ static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg) break; case SNDCTL_SEQ_CTRLRATE: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) /* Can't change */ return -EINVAL; @@ -248,7 +249,7 @@ static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg) default: return -EINVAL; } - return put_user(val, (int *)arg); + return put_user(val, p); } static void timer_arm(int dev, long time) diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index ee1f493caba4e6..7e228966eca926 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c @@ -55,7 +55,7 @@ /* * Table for permanently allocated memory (used when unloading the module) */ -caddr_t sound_mem_blocks[1024]; +void * sound_mem_blocks[1024]; int sound_nblocks = 0; /* Persistent DMA buffers */ @@ -110,7 +110,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) return mixer_vols[n].levels; } -static int set_mixer_levels(caddr_t arg) +static int set_mixer_levels(void __user * arg) { /* mixer_vol_table is 174 bytes, so IMHO no reason to not allocate it on the stack */ mixer_vol_table buf; @@ -123,11 +123,11 @@ static int set_mixer_levels(caddr_t arg) return 0; } -static int get_mixer_levels(caddr_t arg) +static int get_mixer_levels(void __user * arg) { int n; - if (__get_user(n, (int *)(&(((mixer_vol_table *)arg)->num)))) + if (__get_user(n, (int __user *)(&(((mixer_vol_table *__user )arg)->num)))) return -EFAULT; if (n < 0 || n >= num_mixer_volumes) return -EINVAL; @@ -139,7 +139,7 @@ static int get_mixer_levels(caddr_t arg) /* 4K page size but our output routines use some slack for overruns */ #define PROC_BLOCK_SIZE (3*1024) -static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos) +static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int dev = iminor(file->f_dentry->d_inode); int ret = -EINVAL; @@ -172,7 +172,7 @@ static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *pp return ret; } -static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { int dev = iminor(file->f_dentry->d_inode); int ret = -EINVAL; @@ -282,7 +282,7 @@ static int sound_release(struct inode *inode, struct file *file) return 0; } -static int get_mixer_info(int dev, caddr_t arg) +static int get_mixer_info(int dev, void __user *arg) { mixer_info info; memset(&info, 0, sizeof(info)); @@ -294,7 +294,7 @@ static int get_mixer_info(int dev, caddr_t arg) return 0; } -static int get_old_mixer_info(int dev, caddr_t arg) +static int get_old_mixer_info(int dev, void __user *arg) { _old_mixer_info info; memset(&info, 0, sizeof(info)); @@ -305,7 +305,7 @@ static int get_old_mixer_info(int dev, caddr_t arg) return 0; } -static int sound_mixer_ioctl(int mixdev, unsigned int cmd, caddr_t arg) +static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg) { if (mixdev < 0 || mixdev >= MAX_MIXER_DEV) return -ENXIO; @@ -331,24 +331,25 @@ static int sound_ioctl(struct inode *inode, struct file *file, { int err, len = 0, dtype; int dev = iminor(inode); + void __user *p = (void __user *)arg; if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) { /* * Have to validate the address given by the process. */ len = _SIOC_SIZE(cmd); - if (len < 1 || len > 65536 || arg == 0) + if (len < 1 || len > 65536 || !p) return -EFAULT; if (_SIOC_DIR(cmd) & _SIOC_WRITE) - if ((err = verify_area(VERIFY_READ, (void *)arg, len)) < 0) + if ((err = verify_area(VERIFY_READ, p, len)) < 0) return err; if (_SIOC_DIR(cmd) & _SIOC_READ) - if ((err = verify_area(VERIFY_WRITE, (void *)arg, len)) < 0) + if ((err = verify_area(VERIFY_WRITE, p, len)) < 0) return err; } DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg)); if (cmd == OSS_GETVERSION) - return __put_user(SOUND_VERSION, (int *)arg); + return __put_user(SOUND_VERSION, (int __user *)p); if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ (dev & 0x0f) != SND_DEV_CTL) { @@ -358,32 +359,32 @@ static int sound_ioctl(struct inode *inode, struct file *file, case SND_DEV_DSP16: case SND_DEV_AUDIO: return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev, - cmd, (caddr_t)arg); + cmd, p); default: - return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg); + return sound_mixer_ioctl(dev >> 4, cmd, p); } } switch (dev & 0x0f) { case SND_DEV_CTL: if (cmd == SOUND_MIXER_GETLEVELS) - return get_mixer_levels((caddr_t)arg); + return get_mixer_levels(p); if (cmd == SOUND_MIXER_SETLEVELS) - return set_mixer_levels((caddr_t)arg); - return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg); + return set_mixer_levels(p); + return sound_mixer_ioctl(dev >> 4, cmd, p); case SND_DEV_SEQ: case SND_DEV_SEQ2: - return sequencer_ioctl(dev, file, cmd, (caddr_t)arg); + return sequencer_ioctl(dev, file, cmd, p); case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: - return audio_ioctl(dev, file, cmd, (caddr_t)arg); + return audio_ioctl(dev, file, cmd, p); break; case SND_DEV_MIDIN: - return MIDIbuf_ioctl(dev, file, cmd, (caddr_t)arg); + return MIDIbuf_ioctl(dev, file, cmd, p); break; } diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c index d4c1922649f59d..464b5696c56806 100644 --- a/sound/oss/sscape.c +++ b/sound/oss/sscape.c @@ -555,7 +555,7 @@ static int download_boot_block(void *dev_info, copr_buffer * buf) return 0; } -static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, caddr_t arg, int local) +static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local) { copr_buffer *buf; int err; diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c index 459c1741a9deb9..3b7fa02cb29b25 100644 --- a/sound/oss/sys_timer.c +++ b/sound/oss/sys_timer.c @@ -191,13 +191,14 @@ def_tmr_get_time(int dev) } /* same as sound_timer.c:timer_ioctl!? */ -static int def_tmr_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int def_tmr_ioctl(int dev, unsigned int cmd, void __user *arg) { + int __user *p = arg; int val; switch (cmd) { case SNDCTL_TMR_SOURCE: - return __put_user(TMR_INTERNAL, (int *)arg); + return __put_user(TMR_INTERNAL, p); case SNDCTL_TMR_START: tmr_reset(); @@ -213,7 +214,7 @@ static int def_tmr_ioctl(int dev, unsigned int cmd, caddr_t arg) return 0; case SNDCTL_TMR_TIMEBASE: - if (__get_user(val, (int *)arg)) + if (__get_user(val, p)) return -EFAULT; if (val) { if (val < 1) @@ -222,10 +223,10 @@ static int def_tmr_ioctl(int dev, unsigned int cmd, caddr_t arg) val = 1000; curr_timebase = val; } - return __put_user(curr_timebase, (int *)arg); + return __put_user(curr_timebase, p); case SNDCTL_TMR_TEMPO: - if (__get_user(val, (int *)arg)) + if (__get_user(val, p)) return -EFAULT; if (val) { if (val < 8) @@ -238,18 +239,18 @@ static int def_tmr_ioctl(int dev, unsigned int cmd, caddr_t arg) curr_tempo = val; reprogram_timer(); } - return __put_user(curr_tempo, (int *)arg); + return __put_user(curr_tempo, p); case SNDCTL_SEQ_CTRLRATE: - if (__get_user(val, (int *)arg)) + if (__get_user(val, p)) return -EFAULT; if (val != 0) /* Can't change */ return -EINVAL; val = ((curr_tempo * curr_timebase) + 30) / 60; - return __put_user(val, (int *)arg); + return __put_user(val, p); case SNDCTL_SEQ_GETTIME: - return __put_user(curr_ticks, (int *)arg); + return __put_user(curr_ticks, p); case SNDCTL_TMR_METRONOME: /* NOP */ diff --git a/sound/oss/v_midi.c b/sound/oss/v_midi.c index df92aa26eaf6db..656c0636685b04 100644 --- a/sound/oss/v_midi.c +++ b/sound/oss/v_midi.c @@ -120,7 +120,7 @@ static int v_midi_end_read (int dev) /* why -EPERM and not -EINVAL?? */ -static inline int v_midi_ioctl (int dev, unsigned cmd, caddr_t arg) +static inline int v_midi_ioctl (int dev, unsigned cmd, void __user *arg) { return -EPERM; } diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c index 899a6ba75469f8..2c83d03c1dcd65 100644 --- a/sound/oss/via82cxxx_audio.c +++ b/sound/oss/via82cxxx_audio.c @@ -349,8 +349,8 @@ static unsigned via_num_cards; static int via_init_one (struct pci_dev *dev, const struct pci_device_id *id); static void __devexit via_remove_one (struct pci_dev *pdev); -static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos); -static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos); +static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos); +static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos); static unsigned int via_dsp_poll(struct file *file, struct poll_table_struct *wait); static int via_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static int via_dsp_open (struct inode *inode, struct file *file); @@ -2254,11 +2254,11 @@ out: static ssize_t via_dsp_do_read (struct via_info *card, - char *userbuf, size_t count, + char __user *userbuf, size_t count, int nonblock) { DECLARE_WAITQUEUE(wait, current); - const char *orig_userbuf = userbuf; + const char __user *orig_userbuf = userbuf; struct via_channel *chan = &card->ch_in; size_t size; int n, tmp; @@ -2388,7 +2388,7 @@ out: } -static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct via_info *card; int nonblock = (file->f_flags & O_NONBLOCK); @@ -2431,11 +2431,11 @@ out: static ssize_t via_dsp_do_write (struct via_info *card, - const char *userbuf, size_t count, + const char __user *userbuf, size_t count, int nonblock) { DECLARE_WAITQUEUE(wait, current); - const char *orig_userbuf = userbuf; + const char __user *orig_userbuf = userbuf; struct via_channel *chan = &card->ch_out; volatile struct via_sgd_table *sgtable = chan->sgtable; size_t size; @@ -2576,7 +2576,7 @@ out: } -static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct via_info *card; ssize_t rc; @@ -2779,7 +2779,7 @@ out: static int via_dsp_ioctl_space (struct via_info *card, struct via_channel *chan, - void *arg) + void __user *arg) { audio_buf_info info; @@ -2824,7 +2824,7 @@ static int via_dsp_ioctl_space (struct via_info *card, static int via_dsp_ioctl_ptr (struct via_info *card, struct via_channel *chan, - void *arg) + void __user *arg) { count_info info; @@ -2900,6 +2900,8 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, struct via_info *card; struct via_channel *chan; int nonblock = (file->f_flags & O_NONBLOCK); + int __user *ip = (int __user *)arg; + void __user *p = (void __user *)arg; assert (file != NULL); card = file->private_data; @@ -2920,18 +2922,18 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, /* OSS API version. XXX unverified */ case OSS_GETVERSION: DPRINTK ("ioctl OSS_GETVERSION, EXIT, returning SOUND_VERSION\n"); - rc = put_user (SOUND_VERSION, (int *)arg); + rc = put_user (SOUND_VERSION, ip); break; /* list of supported PCM data formats */ case SNDCTL_DSP_GETFMTS: DPRINTK ("DSP_GETFMTS, EXIT, returning AFMT U8|S16_LE\n"); - rc = put_user (AFMT_U8 | AFMT_S16_LE, (int *)arg); + rc = put_user (AFMT_U8 | AFMT_S16_LE, ip); break; /* query or set current channel's PCM data format */ case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -2957,12 +2959,12 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, val = AFMT_U8; } DPRINTK ("SETFMT EXIT, returning %d\n", val); - rc = put_user (val, (int *)arg); + rc = put_user (val, ip); break; /* query or set number of channels (1=mono, 2=stereo, 4/6 for multichannel) */ case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -2987,12 +2989,12 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, val = card->ch_out.channels; } DPRINTK ("CHANNELS EXIT, returning %d\n", val); - rc = put_user (val, (int *)arg); + rc = put_user (val, ip); break; /* enable (val is not zero) or disable (val == 0) stereo */ case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -3010,12 +3012,12 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, val = rc - 1; DPRINTK ("STEREO EXIT, returning %d\n", val); - rc = put_user(val, (int *) arg); + rc = put_user(val, ip); break; /* query or set sampling rate */ case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -3045,7 +3047,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, val = 0; } DPRINTK ("SPEED EXIT, returning %d\n", val); - rc = put_user (val, (int *)arg); + rc = put_user (val, ip); break; /* wait until all buffers have been played, and then stop device */ @@ -3086,7 +3088,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, /* obtain bitmask of device capabilities, such as mmap, full duplex, etc. */ case SNDCTL_DSP_GETCAPS: DPRINTK ("DSP_GETCAPS\n"); - rc = put_user(VIA_DSP_CAP, (int *)arg); + rc = put_user(VIA_DSP_CAP, ip); break; /* obtain buffer fragment size */ @@ -3095,10 +3097,10 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, if (rd) { via_chan_set_buffering(card, &card->ch_in, -1); - rc = put_user(card->ch_in.frag_size, (int *)arg); + rc = put_user(card->ch_in.frag_size, ip); } else if (wr) { via_chan_set_buffering(card, &card->ch_out, -1); - rc = put_user(card->ch_out.frag_size, (int *)arg); + rc = put_user(card->ch_out.frag_size, ip); } break; @@ -3106,28 +3108,28 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, case SNDCTL_DSP_GETISPACE: DPRINTK ("DSP_GETISPACE\n"); if (rd) - rc = via_dsp_ioctl_space (card, &card->ch_in, (void*) arg); + rc = via_dsp_ioctl_space (card, &card->ch_in, p); break; /* obtain information about output buffering */ case SNDCTL_DSP_GETOSPACE: DPRINTK ("DSP_GETOSPACE\n"); if (wr) - rc = via_dsp_ioctl_space (card, &card->ch_out, (void*) arg); + rc = via_dsp_ioctl_space (card, &card->ch_out, p); break; /* obtain information about input hardware pointer */ case SNDCTL_DSP_GETIPTR: DPRINTK ("DSP_GETIPTR\n"); if (rd) - rc = via_dsp_ioctl_ptr (card, &card->ch_in, (void*) arg); + rc = via_dsp_ioctl_ptr (card, &card->ch_in, p); break; /* obtain information about output hardware pointer */ case SNDCTL_DSP_GETOPTR: DPRINTK ("DSP_GETOPTR\n"); if (wr) - rc = via_dsp_ioctl_ptr (card, &card->ch_out, (void*) arg); + rc = via_dsp_ioctl_ptr (card, &card->ch_out, p); break; /* return number of bytes remaining to be played by DMA engine */ @@ -3157,7 +3159,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, assert (val <= (chan->frag_size * chan->frag_number)); DPRINTK ("GETODELAY EXIT, val = %d bytes\n", val); - rc = put_user (val, (int *)arg); + rc = put_user (val, ip); break; } @@ -3166,7 +3168,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, * occur in the future */ case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -3190,7 +3192,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && card->ch_out.is_enabled) val |= PCM_ENABLE_OUTPUT; - rc = put_user(val, (int *)arg); + rc = put_user(val, ip); break; /* Enable full duplex. Since we do this as soon as we are opened @@ -3205,7 +3207,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, /* set fragment size. implemented as a successful no-op for now */ case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) { + if (get_user(val, ip)) { rc = -EFAULT; break; } @@ -3241,7 +3243,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file, /* not implemented */ default: DPRINTK ("unhandled ioctl, cmd==%u, arg==%p\n", - cmd, (void*) arg); + cmd, p); break; } diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c index 86ad13c7a54fbf..00fe5cec9dc124 100644 --- a/sound/oss/vidc.c +++ b/sound/oss/vidc.c @@ -116,7 +116,7 @@ vidc_mixer_set(int mdev, unsigned int level) #undef SCALE } -static int vidc_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +static int vidc_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) { unsigned int val; unsigned int mdev; @@ -127,7 +127,7 @@ static int vidc_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) mdev = _SIOC_NR(cmd); if (_SIOC_DIR(cmd) & _SIOC_WRITE) { - if (get_user(val, (unsigned int *)arg)) + if (get_user(val, (unsigned int __user *)arg)) return -EFAULT; if (mdev < SOUND_MIXER_NRDEVICES) @@ -167,7 +167,7 @@ static int vidc_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) return -EINVAL; } - return put_user(val, (unsigned int *)arg) ? -EFAULT : 0; + return put_user(val, (unsigned int __user *)arg) ? -EFAULT : 0; } static unsigned int vidc_audio_set_format(int dev, unsigned int fmt) diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 7645bb0f50ef10..e438ba506e78bf 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c @@ -240,9 +240,9 @@ enum { /* low-level lithium data */ typedef struct lithium { - caddr_t page0; /* virtual addresses */ - caddr_t page1; - caddr_t page2; + void * page0; /* virtual addresses */ + void * page1; + void * page2; spinlock_t lock; /* protects codec and UST/MSC access */ } lithium_t; @@ -659,7 +659,7 @@ static void li_setup_dma(dma_chan_t *chan, static void li_shutdown_dma(dma_chan_t *chan) { lithium_t *lith = chan->lith; - caddr_t lith1 = lith->page1; + void * lith1 = lith->page1; DBGEV("(chan=0x%p)\n", chan); @@ -698,7 +698,7 @@ static __inline__ void li_activate_dma(dma_chan_t *chan) static void li_deactivate_dma(dma_chan_t *chan) { lithium_t *lith = chan->lith; - caddr_t lith2 = lith->page2; + void * lith2 = lith->page2; chan->ctlval &= ~(LI_CCTL_DMA_ENABLE | LI_CCTL_RPTR | LI_CCTL_WPTR); DBGPV("ctlval = 0x%lx\n", chan->ctlval); @@ -1480,10 +1480,10 @@ typedef struct vwsnd_port { int hwbuf_size; unsigned long hwbuf_paddr; unsigned long hwbuf_vaddr; - caddr_t hwbuf; /* hwbuf == hwbuf_vaddr */ + void * hwbuf; /* hwbuf == hwbuf_vaddr */ int hwbuf_max; /* max bytes to preload */ - caddr_t swbuf; + void * swbuf; unsigned int swbuf_size; /* size in bytes */ unsigned int swb_u_idx; /* index of next user byte */ unsigned int swb_i_idx; /* index of next intr byte */ @@ -3083,7 +3083,7 @@ static int vwsnd_mixer_release(struct inode *inode, struct file *file) /* mixer_read_ioctl handles all read ioctls on the mixer device. */ -static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg) +static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg) { int val = -1; @@ -3145,19 +3145,19 @@ static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg) default: return -EINVAL; } - return put_user(val, (int *) arg); + return put_user(val, (int __user *) arg); } /* mixer_write_ioctl handles all write ioctls on the mixer device. */ -static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg) +static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg) { int val; int err; DBGEV("(devc=0x%p, nr=0x%x, arg=0x%p)\n", devc, nr, arg); - err = get_user(val, (int *) arg); + err = get_user(val, (int __user *) arg); if (err) return -EFAULT; switch (nr) { @@ -3196,7 +3196,7 @@ static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg) } if (val < 0) return val; - return put_user(val, (int *) arg); + return put_user(val, (int __user *) arg); } /* This is the ioctl entry to the mixer driver. */ @@ -3216,9 +3216,9 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl, down(&devc->mix_sema); { if ((cmd & ~nrmask) == MIXER_READ(0)) - retval = mixer_read_ioctl(devc, nr, (caddr_t) arg); + retval = mixer_read_ioctl(devc, nr, (void __user *) arg); else if ((cmd & ~nrmask) == MIXER_WRITE(0)) - retval = mixer_write_ioctl(devc, nr, (caddr_t) arg); + retval = mixer_write_ioctl(devc, nr, (void __user *) arg); else retval = -EINVAL; } @@ -3313,7 +3313,7 @@ static int __init attach_vwsnd(struct address_info *hw_config) devc->rport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER); if (!devc->rport.hwbuf_vaddr) goto fail2; - devc->rport.hwbuf = (caddr_t) devc->rport.hwbuf_vaddr; + devc->rport.hwbuf = (void *) devc->rport.hwbuf_vaddr; devc->rport.hwbuf_paddr = virt_to_phys(devc->rport.hwbuf); /* @@ -3336,7 +3336,7 @@ static int __init attach_vwsnd(struct address_info *hw_config) devc->wport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER); if (!devc->wport.hwbuf_vaddr) goto fail3; - devc->wport.hwbuf = (caddr_t) devc->wport.hwbuf_vaddr; + devc->wport.hwbuf = (void *) devc->wport.hwbuf_vaddr; devc->wport.hwbuf_paddr = virt_to_phys(devc->wport.hwbuf); DBGP("wport hwbuf = 0x%p\n", devc->wport.hwbuf); diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index aa2f1d9607e019..44ab698675d8e4 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c @@ -153,7 +153,7 @@ static spinlock_t waveartist_lock = SPIN_LOCK_UNLOCKED; #else static struct timer_list vnc_timer; static void vnc_configure_mixer(wavnc_info *devc, unsigned int input_mask); -static int vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg); +static int vnc_private_ioctl(int dev, unsigned int cmd, int __user *arg); static void vnc_slider_tick(unsigned long data); #endif @@ -515,7 +515,7 @@ waveartist_start_input(int dev, unsigned long buf, int __count, int intrflag) } static int -waveartist_ioctl(int dev, unsigned int cmd, caddr_t arg) +waveartist_ioctl(int dev, unsigned int cmd, void __user * arg) { return -EINVAL; } @@ -1125,7 +1125,7 @@ waveartist_set_mixer(wavnc_info *devc, int dev, unsigned int level) } static int -waveartist_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) +waveartist_mixer_ioctl(int dev, unsigned int cmd, void __user * arg) { wavnc_info *devc = (wavnc_info *)audio_devs[dev]->devc; int ret = 0, val, nr; @@ -1149,7 +1149,7 @@ waveartist_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) nr = cmd & 0xff; if (_SIOC_DIR(cmd) & _SIOC_WRITE) { - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; switch (nr) { @@ -1196,7 +1196,7 @@ waveartist_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) } if (ret >= 0) - ret = put_user(ret, (int *)arg) ? -EFAULT : 0; + ret = put_user(ret, (int __user *)arg) ? -EFAULT : 0; } return ret; @@ -1804,7 +1804,7 @@ vnc_slider_tick(unsigned long data) } static int -vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) +vnc_private_ioctl(int dev, unsigned int cmd, int __user * arg) { wavnc_info *devc = (wavnc_info *)audio_devs[dev]->devc; int val; @@ -1815,7 +1815,7 @@ vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) u_int prev_spkr_mute, prev_line_mute, prev_auto_state; int val; - if (get_user(val, (int *)arg)) + if (get_user(val, arg)) return -EFAULT; /* check if parameter is logical */ @@ -1845,7 +1845,7 @@ vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) } case SOUND_MIXER_PRIVATE2: - if (get_user(val, (int *)arg)) + if (get_user(val, arg)) return -EFAULT; switch (val) { @@ -1870,7 +1870,7 @@ vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) unsigned long flags; int mixer_reg[15], i, val; - if (get_user(val, (int *)arg)) + if (get_user(val, arg)) return -EFAULT; if (copy_from_user(mixer_reg, (void *)val, sizeof(mixer_reg))) return -EFAULT; @@ -1917,7 +1917,7 @@ vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) (devc->telephone_detect ? VNC_PHONE_DETECT : 0) | (devc->no_autoselect ? VNC_DISABLE_AUTOSWITCH : 0); - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, arg) ? -EFAULT : 0; } if (_SIOC_DIR(cmd) & _SIOC_WRITE) { @@ -1936,7 +1936,7 @@ vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg) if ((cmd & 0xff) == SOUND_MIXER_SPEAKER) { unsigned int val, l, r; - if (get_user(val, (int *)arg)) + if (get_user(val, arg)) return -EFAULT; l = val & 0x7f; diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c index fe9427e93e4937..df6ff556a3b8b4 100644 --- a/sound/oss/wavfront.c +++ b/sound/oss/wavfront.c @@ -114,7 +114,7 @@ #define OSS_SUPPORT_LEVEL 0x1 /* just /dev/sequencer for now */ #if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ -static int (*midi_load_patch) (int devno, int format, const char *addr, +static int (*midi_load_patch) (int devno, int format, const char __user *addr, int offs, int count, int pmgr_flag) = NULL; #endif /* OSS_SUPPORT_SEQ */ @@ -996,7 +996,7 @@ wavefront_freemem (void) static int wavefront_send_sample (wavefront_patch_info *header, - UINT16 *dataptr, + UINT16 __user *dataptr, int data_is_unsigned) { @@ -1512,7 +1512,7 @@ log2_2048(int n) } static int -wavefront_load_gus_patch (int devno, int format, const char *addr, +wavefront_load_gus_patch (int devno, int format, const char __user *addr, int offs, int count, int pmgr_flag) { struct patch_info guspatch; @@ -1636,7 +1636,7 @@ wavefront_load_gus_patch (int devno, int format, const char *addr, /* Now ship it down */ wavefront_send_sample (&samp, - (unsigned short *) &(addr)[sizeof_patch], + (unsigned short __user *) &(addr)[sizeof_patch], (guspatch.mode & WAVE_UNSIGNED) ? 1:0); wavefront_send_patch (&pat); wavefront_send_program (&prog); @@ -1656,7 +1656,7 @@ wavefront_load_gus_patch (int devno, int format, const char *addr, } static int -wavefront_load_patch (const char *addr) +wavefront_load_patch (const char __user *addr) { @@ -1680,7 +1680,7 @@ wavefront_load_patch (const char *addr) case WF_ST_SAMPLE: /* sample or sample_header, based on patch->size */ if (copy_from_user((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + (unsigned char __user *) header.hdrptr, sizeof (wavefront_sample))) return -EFAULT; @@ -1940,18 +1940,18 @@ wavefront_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WFCTL_WFCMD: - if (copy_from_user(&wc, (void *) arg, sizeof (wc))) + if (copy_from_user(&wc, (void __user *) arg, sizeof (wc))) return -EFAULT; if ((err = wavefront_synth_control (cmd, &wc)) == 0) { - if (copy_to_user ((void *) arg, &wc, sizeof (wc))) + if (copy_to_user ((void __user *) arg, &wc, sizeof (wc))) return -EFAULT; } return err; case WFCTL_LOAD_SPP: - return wavefront_load_patch ((const char *) arg); + return wavefront_load_patch ((const char __user *) arg); default: printk (KERN_WARNING LOGNAME "invalid ioctl %#x\n", cmd); @@ -1998,7 +1998,7 @@ wavefront_oss_close (int devno) } static int -wavefront_oss_ioctl (int devno, unsigned int cmd, caddr_t arg) +wavefront_oss_ioctl (int devno, unsigned int cmd, void __user * arg) { wavefront_control wc; @@ -2006,8 +2006,7 @@ wavefront_oss_ioctl (int devno, unsigned int cmd, caddr_t arg) switch (cmd) { case SNDCTL_SYNTH_INFO: - if(copy_to_user(&((char *) arg)[0], &wavefront_info, - sizeof (wavefront_info))) + if(copy_to_user(arg, &wavefront_info, sizeof (wavefront_info))) return -EFAULT; return 0; @@ -2043,7 +2042,7 @@ wavefront_oss_ioctl (int devno, unsigned int cmd, caddr_t arg) } int -wavefront_oss_load_patch (int devno, int format, const char *addr, +wavefront_oss_load_patch (int devno, int format, const char __user *addr, int offs, int count, int pmgr_flag) { diff --git a/sound/oss/wf_midi.c b/sound/oss/wf_midi.c index c1a09affe84533..379e70f2c9f854 100644 --- a/sound/oss/wf_midi.c +++ b/sound/oss/wf_midi.c @@ -537,7 +537,7 @@ static inline int wf_mpu_end_read (int dev) { return 0; } -static int wf_mpu_ioctl (int dev, unsigned cmd, caddr_t arg) +static int wf_mpu_ioctl (int dev, unsigned cmd, void __user *arg) { printk (KERN_WARNING "WF-MPU: Intelligent mode not supported by hardware.\n"); @@ -573,8 +573,7 @@ static struct synth_info wf_mpu_synth_info_proto = static struct synth_info wf_mpu_synth_info[2]; static int -wf_mpu_synth_ioctl (int dev, - unsigned int cmd, caddr_t arg) +wf_mpu_synth_ioctl (int dev, unsigned int cmd, void __user *arg) { int midi_dev; int index; @@ -595,7 +594,7 @@ wf_mpu_synth_ioctl (int dev, switch (cmd) { case SNDCTL_SYNTH_INFO: - if(copy_to_user (&((char *) arg)[0], + if (copy_to_user(arg, &wf_mpu_synth_info[index], sizeof (struct synth_info))) return -EFAULT; diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c index 3db41a7c1181fe..9792521466a500 100644 --- a/sound/synth/emux/emux_oss.c +++ b/sound/synth/emux/emux_oss.c @@ -34,7 +34,7 @@ static int snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure); static int snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg); static int snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg); -static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char *buf, int offs, int count); +static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count); static int snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg); static int snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop); static void reset_port_mode(snd_emux_port_t *port, int midi_mode); @@ -201,7 +201,7 @@ snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg) */ static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, - const char *buf, int offs, int count) + const char __user *buf, int offs, int count) { snd_emux_t *emu; snd_emux_port_t *p; |