All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/4] media: Documentation: Add note about UVCH length field
Date: Mon, 26 May 2025 16:13:23 +0200	[thread overview]
Message-ID: <20250526141323.GQ17743@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCvPG_3qc4Emhat=NdRZXsmNDD0pwh182bXDFK2TgYN_ug@mail.gmail.com>

On Mon, May 26, 2025 at 04:04:03PM +0200, Ricardo Ribalda wrote:
> On Mon, 26 May 2025 at 15:49, Laurent Pinchart wrote:
> > On Fri, Apr 04, 2025 at 06:37:35AM +0000, Ricardo Ribalda wrote:
> > > The documentation currently describes the UVC length field as the "length
> > > of the rest of the block", which can be misleading. The driver limits the
> > > data copied to a maximum of 12 bytes.
> > >
> > > This change adds a clarifying sentence to the documentation to make this
> > > restriction explicit.
> > >
> > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > > ---
> > >  Documentation/userspace-api/media/v4l/metafmt-uvc.rst | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/userspace-api/media/v4l/metafmt-uvc.rst b/Documentation/userspace-api/media/v4l/metafmt-uvc.rst
> > > index 784346d14bbdbf28348262084d5b0646d30bd1da..42599875331c0066cf529153caccb731148023b9 100644
> > > --- a/Documentation/userspace-api/media/v4l/metafmt-uvc.rst
> > > +++ b/Documentation/userspace-api/media/v4l/metafmt-uvc.rst
> > > @@ -44,7 +44,9 @@ Each individual block contains the following fields:
> > >          them
> > >      * - :cspan:`1` *The rest is an exact copy of the UVC payload header:*
> > >      * - __u8 length;
> > > -      - length of the rest of the block, including this field
> > > +      - length of the rest of the block, including this field. Please note that
> > > +        regardless of the this value, for V4L2_META_FMT_UVC the kernel will
> >
> > "the this value" looks like a typo.
> 
> Thanks! Will fix in v2
> 
> >
> > > +        never copy more than 2-12 bytes.
> >
> > Are you saying here that length can be larger than 12, but only up to 12
> > bytes will be copied (when both SCR and PTS are present) ? If that's the
> > case, it would be better to fix the driver to clamp the length value to
> > the number of bytes actually present in the buffer.
> 
> As the documentation says, this is an exact copy of the UVC payload header.
> 
> Assuming SCR and PTS, for devices that have metadata length will be
> the real length provided by the hardware. but buf[] will only contain
> 12 bytes.
> 
> Replacing the value of length with the actual value will be a uAPI
> breakage. I do not think that is a very good idea to change it,
> considering that this number is used by parsers.

Do you think there could be userspace code that relies on the value
being larger than 12, even though the metadata after the standard UVC
block isn't present in the buffer ? Are you aware of any particular
implementation of such userspace code ?

> > >      * - __u8 flags;
> > >        - Flags, indicating presence of other standard UVC fields
> > >      * - __u8 buf[];

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-05-26 14:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04  6:37 [PATCH v5 0/4] media: uvcvideo: Introduce V4L2_META_FMT_UVC_MSXU_1_5 + other meta fixes Ricardo Ribalda
2025-04-04  6:37 ` [PATCH v5 1/4] media: uvcvideo: Do not mark valid metadata as invalid Ricardo Ribalda
2025-05-26 13:12   ` Hans de Goede
2025-05-26 13:46   ` Laurent Pinchart
2025-04-04  6:37 ` [PATCH v5 2/4] media: Documentation: Add note about UVCH length field Ricardo Ribalda
2025-05-26 13:12   ` Hans de Goede
2025-05-26 13:49   ` Laurent Pinchart
2025-05-26 14:04     ` Ricardo Ribalda
2025-05-26 14:13       ` Laurent Pinchart [this message]
2025-05-26 14:20         ` Ricardo Ribalda
2025-04-04  6:37 ` [PATCH v5 3/4] media: uvcvideo: Introduce V4L2_META_FMT_UVC_MSXU_1_5 Ricardo Ribalda
2025-05-26 13:16   ` Hans de Goede
2025-05-26 13:53   ` Laurent Pinchart
2025-04-04  6:37 ` [PATCH v5 4/4] media: uvcvideo: Auto-set UVC_QUIRK_MSXU_META Ricardo Ribalda
2025-05-26 13:19   ` Hans de Goede
2025-05-26 14:02   ` Laurent Pinchart
2025-05-26 14:17     ` Ricardo Ribalda
2025-05-05  9:06 ` [PATCH v5 0/4] media: uvcvideo: Introduce V4L2_META_FMT_UVC_MSXU_1_5 + other meta fixes Ricardo Ribalda

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=20250526141323.GQ17743@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=guennadi.liakhovetski@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.