usx2y: don't bother with access_ok() in ->dsp_load()
memdup_user() checks it, so the only effect would be failing with -EINVAL instead of -EFAULT in case when access_ok() is false. However, the caller has already checked access_ok() itself (and would have buggered off with -EFAULT), so the check is completely pointless. Removing it both simplifies the only instance of ->dsp_load() and allows to get rid of the check in caller - its sole effect used to be in preventing a bogus error value from access_ok() in the instance. Let memdup_user() do the right thing instead... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
3d26759c09
Коммит
fc1c428eb4
|
@ -198,13 +198,12 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||||
struct snd_hwdep_dsp_image *dsp)
|
struct snd_hwdep_dsp_image *dsp)
|
||||||
{
|
{
|
||||||
struct usX2Ydev *priv = hw->private_data;
|
struct usX2Ydev *priv = hw->private_data;
|
||||||
int lret, err = -EINVAL;
|
|
||||||
snd_printdd( "dsp_load %s\n", dsp->name);
|
|
||||||
|
|
||||||
if (access_ok(VERIFY_READ, dsp->image, dsp->length)) {
|
|
||||||
struct usb_device* dev = priv->dev;
|
struct usb_device* dev = priv->dev;
|
||||||
|
int lret, err;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
|
snd_printdd( "dsp_load %s\n", dsp->name);
|
||||||
|
|
||||||
buf = memdup_user(dsp->image, dsp->length);
|
buf = memdup_user(dsp->image, dsp->length);
|
||||||
if (IS_ERR(buf))
|
if (IS_ERR(buf))
|
||||||
return PTR_ERR(buf);
|
return PTR_ERR(buf);
|
||||||
|
@ -215,7 +214,6 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||||
else
|
else
|
||||||
err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000);
|
err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
}
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
if (dsp->index == 1) {
|
if (dsp->index == 1) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче