aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>2004-06-03 04:19:22 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-03 04:19:22 -0700
commit5a1c7700d664d88062c69842efd693f5a1aa03af (patch)
tree873fbbf67d7e8467f309af9b21fd6b18fcdea020 /sound
parent76ae908ac866c44a9bf1cda11089f3048d3de93a (diff)
downloadhistory-5a1c7700d664d88062c69842efd693f5a1aa03af.tar.gz
[PATCH] sparse: wavefront annotation
Both ALSA and OSS drivers + wavefront ioctl structure annotated. NB: both should be switched to generic firmware loading - as it is, they are using a homegrown and rather ugly variant
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/wavefront/wavefront_fx.c4
-rw-r--r--sound/isa/wavefront/wavefront_synth.c31
-rw-r--r--sound/oss/wavfront.c23
3 files changed, 24 insertions, 34 deletions
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 01d6647c140e6e..92d9c85a45f82a 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -179,7 +179,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file,
acard = card->private_data;
dev = &acard->wavefront;
- if (copy_from_user (&r, (unsigned char *) arg, sizeof (wavefront_fx_info)))
+ if (copy_from_user (&r, (void __user *)arg, sizeof (wavefront_fx_info)))
return -EFAULT;
switch (r.request) {
@@ -201,7 +201,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file,
return -EIO;
}
if (copy_from_user (page_data,
- (unsigned char *) r.data[3],
+ (unsigned char __user *) r.data[3],
r.data[2]))
return -EFAULT;
pd = page_data;
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index af561df2a413f0..9b65db0b194158 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -861,7 +861,7 @@ wavefront_freemem (snd_wavefront_t *dev)
static int
wavefront_send_sample (snd_wavefront_t *dev,
wavefront_patch_info *header,
- u16 *dataptr,
+ u16 __user *dataptr,
int data_is_unsigned)
{
@@ -876,7 +876,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
u16 sample_short;
u32 length;
- u16 *data_end = 0;
+ u16 __user *data_end = 0;
unsigned int i;
const unsigned int max_blksize = 4096/2;
unsigned int written;
@@ -1355,7 +1355,7 @@ wavefront_find_free_patch (snd_wavefront_t *dev)
#endif
static int
-wavefront_load_patch (snd_wavefront_t *dev, const char *addr)
+wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
{
wavefront_patch_info header;
@@ -1377,8 +1377,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr)
switch (header.subkey) {
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,
+ if (copy_from_user (&header.hdr.s, header.hdrptr,
sizeof (wavefront_sample)))
return -EFAULT;
@@ -1386,8 +1385,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr)
case WF_ST_MULTISAMPLE:
- if (copy_from_user ((unsigned char *) &header.hdr.s,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user (&header.hdr.s, header.hdrptr,
sizeof (wavefront_multisample)))
return -EFAULT;
@@ -1396,32 +1394,28 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr)
case WF_ST_ALIAS:
- if (copy_from_user ((unsigned char *) &header.hdr.a,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user (&header.hdr.a, header.hdrptr,
sizeof (wavefront_alias)))
return -EFAULT;
return wavefront_send_alias (dev, &header);
case WF_ST_DRUM:
- if (copy_from_user ((unsigned char *) &header.hdr.d,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user (&header.hdr.d, header.hdrptr,
sizeof (wavefront_drum)))
return -EFAULT;
return wavefront_send_drum (dev, &header);
case WF_ST_PATCH:
- if (copy_from_user ((unsigned char *) &header.hdr.p,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user (&header.hdr.p, header.hdrptr,
sizeof (wavefront_patch)))
return -EFAULT;
return wavefront_send_patch (dev, &header);
case WF_ST_PROGRAM:
- if (copy_from_user ((unsigned char *) &header.hdr.pr,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user (&header.hdr.pr, header.hdrptr,
sizeof (wavefront_program)))
return -EFAULT;
@@ -1627,6 +1621,7 @@ snd_wavefront_synth_ioctl (snd_hwdep_t *hw, struct file *file,
snd_wavefront_t *dev;
snd_wavefront_card_t *acard;
wavefront_control wc;
+ void __user *argp = (void __user *)arg;
card = (snd_card_t *) hw->card;
@@ -1639,18 +1634,18 @@ snd_wavefront_synth_ioctl (snd_hwdep_t *hw, struct file *file,
switch (cmd) {
case WFCTL_LOAD_SPP:
- if (wavefront_load_patch (dev, (char *) arg) != 0) {
+ if (wavefront_load_patch (dev, argp) != 0) {
return -EIO;
}
break;
case WFCTL_WFCMD:
- if (copy_from_user (&wc, (void *) arg, sizeof (wc)))
+ if (copy_from_user (&wc, argp, sizeof (wc)))
return -EFAULT;
if (wavefront_synth_control (acard, &wc) < 0) {
return -EIO;
}
- if (copy_to_user ((void *) arg, &wc, sizeof (wc)))
+ if (copy_to_user (argp, &wc, sizeof (wc)))
return -EFAULT;
break;
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c
index df6ff556a3b8b4..e7932229e6b6f4 100644
--- a/sound/oss/wavfront.c
+++ b/sound/oss/wavfront.c
@@ -1011,7 +1011,7 @@ wavefront_send_sample (wavefront_patch_info *header,
UINT16 sample_short;
UINT32 length;
- UINT16 *data_end = 0;
+ UINT16 __user *data_end = 0;
unsigned int i;
const int max_blksize = 4096/2;
unsigned int written;
@@ -1024,11 +1024,11 @@ wavefront_send_sample (wavefront_patch_info *header,
int initial_skip = 0;
DPRINT (WF_DEBUG_LOAD_PATCH, "sample %sdownload for slot %d, "
- "type %d, %d bytes from 0x%x\n",
+ "type %d, %d bytes from %p\n",
header->size ? "" : "header ",
header->number, header->subkey,
header->size,
- (int) header->dataptr);
+ header->dataptr);
if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) {
int x;
@@ -1688,8 +1688,7 @@ wavefront_load_patch (const char __user *addr)
case WF_ST_MULTISAMPLE:
- if (copy_from_user((unsigned char *) &header.hdr.s,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.s, header.hdrptr,
sizeof(wavefront_multisample)))
return -EFAULT;
@@ -1698,32 +1697,28 @@ wavefront_load_patch (const char __user *addr)
case WF_ST_ALIAS:
- if (copy_from_user((unsigned char *) &header.hdr.a,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.a, header.hdrptr,
sizeof (wavefront_alias)))
return -EFAULT;
return wavefront_send_alias (&header);
case WF_ST_DRUM:
- if (copy_from_user((unsigned char *) &header.hdr.d,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.d, header.hdrptr,
sizeof (wavefront_drum)))
return -EFAULT;
return wavefront_send_drum (&header);
case WF_ST_PATCH:
- if (copy_from_user((unsigned char *) &header.hdr.p,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.p, header.hdrptr,
sizeof (wavefront_patch)))
return -EFAULT;
return wavefront_send_patch (&header);
case WF_ST_PROGRAM:
- if (copy_from_user((unsigned char *) &header.hdr.pr,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.pr, header.hdrptr,
sizeof (wavefront_program)))
return -EFAULT;
@@ -3002,7 +2997,7 @@ wffx_ioctl (wavefront_fx_info *r)
return -(EINVAL);
}
if (copy_from_user(page_data,
- (unsigned char *)r->data[3],
+ (unsigned char __user *)r->data[3],
r->data[2]))
return -EFAULT;
pd = page_data;