patch-2.1.77 linux/drivers/sound/sscape.c
Next file: linux/drivers/sound/sys_timer.c
Previous file: linux/drivers/sound/soundmodule.h
Back to the patch index
Back to the overall index
- Lines: 69
- Date:
Tue Dec 30 10:59:17 1997
- Orig file:
v2.1.76/linux/drivers/sound/sscape.c
- Orig date:
Sat Nov 29 11:25:11 1997
diff -u --recursive --new-file v2.1.76/linux/drivers/sound/sscape.c linux/drivers/sound/sscape.c
@@ -10,6 +10,9 @@
* Version 2 (June 1991). See the "COPYING" file distributed with this software
* for more info.
*/
+/*
+ * Thomas Sailer : ioctl code reworked (vmalloc/vfree removed)
+ */
#include <linux/config.h>
#include <linux/module.h>
@@ -570,36 +573,31 @@
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, caddr_t arg, int local)
{
+ copr_buffer *buf;
+ int err;
- switch (cmd)
- {
- case SNDCTL_COPR_RESET:
- sscape_coproc_reset(dev_info);
- return 0;
- break;
-
- case SNDCTL_COPR_LOAD:
- {
- copr_buffer *buf;
- int err;
-
- buf = (copr_buffer *) vmalloc(sizeof(copr_buffer));
- if (buf == NULL)
- return -ENOSPC;
- memcpy((char *) buf, (&((char *) arg)[0]), sizeof(*buf));
- err = download_boot_block(dev_info, buf);
- vfree(buf);
- return err;
- }
- break;
-
- default:
- return -EINVAL;
- }
+ switch (cmd) {
+ case SNDCTL_COPR_RESET:
+ sscape_coproc_reset(dev_info);
+ return 0;
+ case SNDCTL_COPR_LOAD:
+ buf = (copr_buffer *) vmalloc(sizeof(copr_buffer));
+ if (buf == NULL)
+ return -ENOSPC;
+ if (__copy_from_user(buf, arg, sizeof(copr_buffer))) {
+ vfree(buf);
+ return -EFAULT;
+ }
+ err = download_boot_block(dev_info, buf);
+ vfree(buf);
+ return err;
+
+ default:
+ return -EINVAL;
+ }
}
static coproc_operations sscape_coproc_operations =
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov