* [PATCH] v4l2-ctrls: avoid a sparse complain due to __user ptr
@ 2014-09-03 23:19 Mauro Carvalho Chehab
2014-09-04 6:14 ` Hans Verkuil
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2014-09-03 23:19 UTC (permalink / raw)
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Hans Verkuil, Sylwester Nawrocki,
Sakari Ailus, Kamil Debski, Antti Palosaari, Jonathan McCrohan
c->ptr was already copied to Kernelspace. So, this sparse warning
is bogus:
>> drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: sparse: incorrect type in assignment (different address spaces)
drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: expected void *[assigned] p
drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: got void [noderef] <asn:1>*ptr
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 35d1f3d5045b..ed10e4a9318c 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1682,7 +1682,7 @@ static int validate_new(const struct v4l2_ctrl *ctrl,
break;
}
}
- ptr.p = c->ptr;
+ ptr.p = (__force void *)c->ptr;
for (idx = 0; !err && idx < c->size / ctrl->elem_size; idx++)
err = ctrl->type_ops->validate(ctrl, idx, ptr);
return err;
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] v4l2-ctrls: avoid a sparse complain due to __user ptr
2014-09-03 23:19 [PATCH] v4l2-ctrls: avoid a sparse complain due to __user ptr Mauro Carvalho Chehab
@ 2014-09-04 6:14 ` Hans Verkuil
0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2014-09-04 6:14 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab,
Sylwester Nawrocki, Sakari Ailus, Kamil Debski, Antti Palosaari,
Jonathan McCrohan
On 09/04/2014 01:19 AM, Mauro Carvalho Chehab wrote:
> c->ptr was already copied to Kernelspace. So, this sparse warning
> is bogus:
>
>>> drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: sparse: incorrect type in assignment (different address spaces)
> drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: expected void *[assigned] p
> drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: got void [noderef] <asn:1>*ptr
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Nacked-by: Hans Verkuil <hans.verkuil@cisco.com>
Unfortunately, c->ptr can be a true user pointer. For once, this sparse warning
points to a real bug. It's not that easy to fix and I will need to think some
more how this should be handled.
Regards,
Hans
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 35d1f3d5045b..ed10e4a9318c 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1682,7 +1682,7 @@ static int validate_new(const struct v4l2_ctrl *ctrl,
> break;
> }
> }
> - ptr.p = c->ptr;
> + ptr.p = (__force void *)c->ptr;
> for (idx = 0; !err && idx < c->size / ctrl->elem_size; idx++)
> err = ctrl->type_ops->validate(ctrl, idx, ptr);
> return err;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-04 6:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 23:19 [PATCH] v4l2-ctrls: avoid a sparse complain due to __user ptr Mauro Carvalho Chehab
2014-09-04 6:14 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).