X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fisa%2Fwavefront%2Fwavefront_fx.c;h=180661c5ffdc916df766ce4320c2e86f79d0231b;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=92aa782d661ddaaca1379a5dee569144cd1a65da;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 92aa782d6..180661c5f 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -460,7 +460,7 @@ snd_wavefront_fx_detect (snd_wavefront_t *dev) } int -snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file) +snd_wavefront_fx_open (struct snd_hwdep *hw, struct file *file) { if (!try_module_get(hw->card->module)) @@ -470,7 +470,7 @@ snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file) } int -snd_wavefront_fx_release (snd_hwdep_t *hw, struct file *file) +snd_wavefront_fx_release (struct snd_hwdep *hw, struct file *file) { module_put(hw->card->module); @@ -478,16 +478,17 @@ snd_wavefront_fx_release (snd_hwdep_t *hw, struct file *file) } int -snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file, +snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, unsigned int cmd, unsigned long arg) { - snd_card_t *card; + struct snd_card *card; snd_wavefront_card_t *acard; snd_wavefront_t *dev; wavefront_fx_info r; - unsigned short page_data[256]; + unsigned short *page_data = NULL; unsigned short *pd; + int err = 0; snd_assert(sdev->card != NULL, return -ENODEV); @@ -514,23 +515,29 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file, } else if (r.data[2] == 1) { pd = (unsigned short *) &r.data[3]; } else { - if (r.data[2] > (long)sizeof (page_data)) { + if (r.data[2] > 256) { snd_printk ("cannot write " - "> 255 bytes to FX\n"); + "> 512 bytes to FX\n"); return -EIO; } + page_data = kmalloc(r.data[2] * sizeof(short), GFP_KERNEL); + if (!page_data) + return -ENOMEM; if (copy_from_user (page_data, (unsigned char __user *) r.data[3], - r.data[2])) + r.data[2] * sizeof(short))) { + kfree(page_data); return -EFAULT; + } pd = page_data; } - wavefront_fx_memset (dev, + err = wavefront_fx_memset (dev, r.data[0], /* page */ r.data[1], /* addr */ r.data[2], /* cnt */ pd); + kfree(page_data); break; default: @@ -538,7 +545,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file, r.request); return -ENOTTY; } - return 0; + return err; } /* YSS225 initialization.