From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Kamil Debski <k.debski@samsung.com>,
Antti Palosaari <crope@iki.fi>,
Jonathan McCrohan <jmccrohan@gmail.com>
Subject: Re: [PATCH] v4l2-ctrls: avoid a sparse complain due to __user ptr
Date: Thu, 04 Sep 2014 08:14:24 +0200 [thread overview]
Message-ID: <54080340.8050609@xs4all.nl> (raw)
In-Reply-To: <3de557fce274288343f3ac7f5b3e0dac87f123bf.1409786360.git.m.chehab@samsung.com>
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;
>
prev parent reply other threads:[~2014-09-04 6:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54080340.8050609@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=crope@iki.fi \
--cc=jmccrohan@gmail.com \
--cc=k.debski@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=mchehab@infradead.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sylvester.nawrocki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).