public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>, linux-media@vger.kernel.org
Cc: Maxime Jourdan <mjourdan@baylibre.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Alexandre Courbot <acourbot@chromium.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Boris Brezillon <boris.brezillon@collabora.com>
Subject: Re: [PATCH 01/14] v4l2-ioctl.c: OR flags in v4l_fill_fmtdesc(), not don't overwrite
Date: Wed, 24 Jul 2019 16:34:14 +0200	[thread overview]
Message-ID: <1563978854.2914.15.camel@pengutronix.de> (raw)
In-Reply-To: <8559fd11-e6b7-092d-08b3-dc92f92ee089@xs4all.nl>

On Wed, 2019-07-24 at 15:30 +0200, Hans Verkuil wrote:
> On 7/24/19 3:22 PM, Philipp Zabel wrote:
> > On Wed, 2019-07-24 at 13:05 +0200, Hans Verkuil wrote:
> > > If a driver sets a FMT flag in the enum_fmt op, then that will be
> > > ignored since v4l_fill_fmtdesc() overwrites it again.
> > > 
> > > v4l_fill_fmtdesc() should OR its flag, not overwrite it.
> > > 
> > > Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> > > ---
> > >  drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> > > index 80efc581e3f9..911a20f915c5 100644
> > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > > @@ -1390,7 +1390,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> > >  
> > >  	if (descr)
> > >  		WARN_ON(strscpy(fmt->description, descr, sz) < 0);
> > > -	fmt->flags = flags;
> > > +	fmt->flags |= flags;
> > >  }
> > >  
> > >  static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
> > 
> > If the enum_fmt op does not write fmt->flags, will it not contain the
> > value provided by userspace at this point? I think p->flags must be
> > cleared in v4l2_enum_fmt() with this change, before the enum_fmt op is
> > called.
> 
> All fields after 'type' in struct v4l2_fmtdesc are cleared by the core:
> search for INFO_FL_CLEAR(v4l2_fmtdesc, type) in v4l2-ioctl.c.
> 
> So 'flags' is already zeroed when this function is called.

Got it, thanks. In that case,

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

  reply	other threads:[~2019-07-24 14:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 11:05 [PATCH 00/14] Stateful/stateless codec core support Hans Verkuil
2019-07-24 11:05 ` [PATCH 01/14] v4l2-ioctl.c: OR flags in v4l_fill_fmtdesc(), not don't overwrite Hans Verkuil
2019-07-24 13:22   ` Philipp Zabel
2019-07-24 13:30     ` Hans Verkuil
2019-07-24 14:34       ` Philipp Zabel [this message]
2019-07-24 11:05 ` [PATCH 02/14] videodev2.h: add V4L2_FMT_FLAG_HAS_BITSTREAM_PARSER Hans Verkuil
2019-07-27  9:37   ` Paul Kocialkowski
2019-07-28 14:05     ` Tomasz Figa
2019-07-29 13:12       ` Paul Kocialkowski
2019-07-29 13:18         ` Tomasz Figa
2019-07-30  7:21           ` Hans Verkuil
2019-08-01 14:24             ` Nicolas Dufresne
2019-07-24 11:05 ` [PATCH 03/14] videodev2.h: add V4L2_FMT_FLAG_DYN_RESOLUTION Hans Verkuil
2019-07-24 11:05 ` [PATCH 04/14] videodev2.h.rst.exceptions: tymecode -> timecode Hans Verkuil
2019-07-27  9:43   ` Paul Kocialkowski
2019-07-24 11:05 ` [PATCH 05/14] media: venus: vdec: flag OUTPUT formats with V4L2_FMT_FLAG_DYN_RESOLUTION Hans Verkuil
2019-07-24 11:05 ` [PATCH 06/14] media: s5p_mfc_dec: set flags for OUTPUT coded formats Hans Verkuil
2019-07-26  9:12 ` [PATCH 00/14] Stateful/stateless codec core support Hans Verkuil
  -- strict thread matches above, loose matches on Subject: below --
2019-07-24 11:10 Hans Verkuil
2019-07-24 11:10 ` [PATCH 01/14] v4l2-ioctl.c: OR flags in v4l_fill_fmtdesc(), not don't overwrite Hans Verkuil
2019-07-24 11:27 [PATCH 00/14] Stateful/stateless codec core support (resend) Hans Verkuil
2019-07-24 11:27 ` [PATCH 01/14] v4l2-ioctl.c: OR flags in v4l_fill_fmtdesc(), not don't overwrite Hans Verkuil

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=1563978854.2914.15.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=acourbot@chromium.org \
    --cc=boris.brezillon@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=mjourdan@baylibre.com \
    --cc=nicolas@ndufresne.ca \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=s.nawrocki@samsung.com \
    --cc=stanimir.varbanov@linaro.org \
    --cc=tfiga@chromium.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