From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/3] media: v4l2-subdev: Verify arguments in v4l2_subdev_call()
Date: Wed, 15 May 2019 10:16:02 +0300 [thread overview]
Message-ID: <20190515071601.knfdhwofz6ukjmxt@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20190514224823.11564-2-jmkrzyszt@gmail.com>
Hi Janusz,
On Wed, May 15, 2019 at 12:48:21AM +0200, Janusz Krzysztofik wrote:
> -static int check_crop(struct v4l2_subdev *sd, struct v4l2_subdev_crop *crop)
> +static inline int check_pad(struct v4l2_subdev *sd, __u32 pad)
> {
> - if (crop->which != V4L2_SUBDEV_FORMAT_TRY &&
> - crop->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + if (sd->entity.num_pads && pad >= sd->entity.num_pads)
One more comment.
The num_pads doesn't really tell whether a given op is valid for a device.
Well, in this case it would have to be a bug in the driver, but those do
happen. How about checking for sd->entity.graph_obj.mdev instead? It's
non-NULL if the entity is registered with a media device, i.e. when these
callback functions are supposed to be called.
--
Sakari Ailus
sakari.ailus@linux.intel.com
next prev parent reply other threads:[~2019-05-15 7:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 22:48 [PATCH v6 0/3] media: v4l2-subdev: Verify arguments in v4l2_subdev_call() Janusz Krzysztofik
2019-05-14 22:48 ` [PATCH v6 1/3] " Janusz Krzysztofik
2019-05-15 7:16 ` Sakari Ailus [this message]
2019-05-15 20:56 ` Janusz Krzysztofik
2019-05-17 15:58 ` Sakari Ailus
2019-05-17 22:07 ` Janusz Krzysztofik
2019-05-14 22:48 ` [PATCH v6 2/3] media: v4l2-subdev: Verify v4l2_subdev_call() pointer arguments Janusz Krzysztofik
2019-05-14 22:48 ` [PATCH v6 3/3] media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument Janusz Krzysztofik
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=20190515071601.knfdhwofz6ukjmxt@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jmkrzyszt@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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).