Commit 5a1c7700 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[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
parent 76ae908a
......@@ -554,8 +554,8 @@ typedef struct wf_patch_info {
WF_{GET,SET}_CHANNEL above.
*/
wavefront_any *hdrptr; /* user-space ptr to hdr bytes */
u16 *dataptr; /* actual sample data */
wavefront_any __user *hdrptr; /* user-space ptr to hdr bytes */
u16 __user *dataptr; /* actual sample data */
wavefront_any hdr; /* kernel-space copy of hdr bytes */
} wavefront_patch_info;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment