summaryrefslogtreecommitdiff
path: root/sound/pci/emu10k1/emufx.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-08-22 03:06:42 +0300
committerDavid S. Miller <davem@davemloft.net>2017-08-22 03:06:42 +0300
commite2a7c34fb2856fd5306e307e170e3dde358d0dce (patch)
treeafeb300b04186b1a1f649b2cd8a401a75878297c /sound/pci/emu10k1/emufx.c
parent7d3f0cd43feea1636dd7746f22fe8249b34d1b79 (diff)
parent6470812e22261d2342ef1597be62e63a0423d691 (diff)
downloadlinux-e2a7c34fb2856fd5306e307e170e3dde358d0dce.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'sound/pci/emu10k1/emufx.c')
-rw-r--r--sound/pci/emu10k1/emufx.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index dc585959ca32..a2b56b188be4 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -698,10 +698,18 @@ static int copy_gctl(struct snd_emu10k1 *emu,
{
struct snd_emu10k1_fx8010_control_old_gpr __user *octl;
- if (emu->support_tlv)
- return copy_from_user(gctl, &_gctl[idx], sizeof(*gctl));
+ if (emu->support_tlv) {
+ if (in_kernel)
+ memcpy(gctl, (void *)&_gctl[idx], sizeof(*gctl));
+ else if (copy_from_user(gctl, &_gctl[idx], sizeof(*gctl)))
+ return -EFAULT;
+ return 0;
+ }
+
octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl;
- if (copy_from_user(gctl, &octl[idx], sizeof(*octl)))
+ if (in_kernel)
+ memcpy(gctl, (void *)&octl[idx], sizeof(*octl));
+ else if (copy_from_user(gctl, &octl[idx], sizeof(*octl)))
return -EFAULT;
gctl->tlv = NULL;
return 0;