diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-24 17:15:22 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-26 13:47:52 +0400 |
commit | 71d1b2bec07c8aec4252111a84699273f50fdc52 (patch) | |
tree | ee4e79cfc1c7cfd63e29b2153852d999d1d3f8c6 | |
parent | 289297b9a33d4de9644c422c0cf6349387af8ad3 (diff) | |
download | linux-71d1b2bec07c8aec4252111a84699273f50fdc52.tar.xz |
[media] dvb_frontend: Fix __user namespace
As reported by smatch:
drivers/media/dvb-core/dvb_frontend.c:1960:45: warning: incorrect type in argument 2 (different address spaces)
drivers/media/dvb-core/dvb_frontend.c:1960:45: expected void const [noderef] <asn:1>*from
drivers/media/dvb-core/dvb_frontend.c:1960:45: got struct dtv_property *[noderef] <asn:1>props
drivers/media/dvb-core/dvb_frontend.c:1992:45: warning: incorrect type in argument 2 (different address spaces)
drivers/media/dvb-core/dvb_frontend.c:1992:45: expected void const [noderef] <asn:1>*from
drivers/media/dvb-core/dvb_frontend.c:1992:45: got struct dtv_property *[noderef] <asn:1>props
drivers/media/dvb-core/dvb_frontend.c:2014:38: warning: incorrect type in argument 1 (different address spaces)
drivers/media/dvb-core/dvb_frontend.c:2014:38: expected void [noderef] <asn:1>*to
drivers/media/dvb-core/dvb_frontend.c:2014:38: got struct dtv_property *[noderef] <asn:1>props
drivers/media/dvb-core/dvb_frontend.c:1946:17: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1947:17: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1951:22: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1951:42: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1954:31: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1960:41: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1960:54: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1965:33: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1978:17: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1979:17: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1983:22: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1983:42: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1986:31: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1992:41: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:1992:54: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:2007:33: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:2014:34: warning: dereference of noderef expression
drivers/media/dvb-core/dvb_frontend.c:2014:52: warning: dereference of noderef expression
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/dvb-core/dvb_frontend.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c862ad732d9e..b8579ee68bd6 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1934,15 +1934,13 @@ static int dvb_frontend_ioctl_properties(struct file *file, struct dtv_frontend_properties *c = &fe->dtv_property_cache; int err = 0; - struct dtv_properties *tvps = NULL; + struct dtv_properties *tvps = parg; struct dtv_property *tvp = NULL; int i; dev_dbg(fe->dvb->device, "%s:\n", __func__); - if(cmd == FE_SET_PROPERTY) { - tvps = (struct dtv_properties __user *)parg; - + if (cmd == FE_SET_PROPERTY) { dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); @@ -1957,7 +1955,8 @@ static int dvb_frontend_ioctl_properties(struct file *file, goto out; } - if (copy_from_user(tvp, tvps->props, tvps->num * sizeof(struct dtv_property))) { + if (copy_from_user(tvp, (void __user *)tvps->props, + tvps->num * sizeof(struct dtv_property))) { err = -EFAULT; goto out; } @@ -1972,10 +1971,7 @@ static int dvb_frontend_ioctl_properties(struct file *file, if (c->state == DTV_TUNE) dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); - } else - if(cmd == FE_GET_PROPERTY) { - tvps = (struct dtv_properties __user *)parg; - + } else if (cmd == FE_GET_PROPERTY) { dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); @@ -1990,7 +1986,8 @@ static int dvb_frontend_ioctl_properties(struct file *file, goto out; } - if (copy_from_user(tvp, tvps->props, tvps->num * sizeof(struct dtv_property))) { + if (copy_from_user(tvp, (void __user *)tvps->props, + tvps->num * sizeof(struct dtv_property))) { err = -EFAULT; goto out; } @@ -2012,7 +2009,8 @@ static int dvb_frontend_ioctl_properties(struct file *file, (tvp + i)->result = err; } - if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { + if (copy_to_user((void __user *)tvps->props, tvp, + tvps->num * sizeof(struct dtv_property))) { err = -EFAULT; goto out; } |