From: sashiko-bot@kernel.org
To: "Alain Volmat" <alain.volmat@foss.st.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v2 12/13] media: stm32: dcmipp: rename bytecap into capture
Date: Tue, 02 Jun 2026 13:39:48 +0000 [thread overview]
Message-ID: <20260602133948.629B91F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602-stm32-dcmipp-pixel-pipes-support-v2-12-3c76b5f93157@foss.st.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] The driver calculates pixel alignment requirements using an unvalidated user format, resulting in missed hardware alignment constraints and unaligned memory access.
- [Low] Stale comment references the old `dcmipp_bytecap_device` structure name.
Pre-existing issues:
- [High] The `dcmipp_capture_start_streaming` function leaks queued buffers if the source subdev cannot be found.
--
commit c041aaac664f7bb802b626e9d71a0c93fba4ced4
Author: Alain Volmat <alain.volmat@foss.st.com>
Subject: media: stm32: dcmipp: rename bytecap into capture
Since the bytecap video driver is now handling all capture (byte & pixel),
rename the file and structs into capture.
> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c
> --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c
[ ... ]
> @@ -371,7 +371,7 @@ static int dcmipp_bytecap_try_fmt_vid_cap(struct file *file, void *priv,
> u32 in_w, in_h;
>
> /* Don't accept a pixelformat that is not on the table */
> - if (!dcmipp_bytecap_is_format_valid(vcap, format->pixelformat))
> + if (!dcmipp_capture_is_format_valid(vcap, format->pixelformat))
> format->pixelformat = fmt_default.pixelformat;
[Severity: High]
Does this code fail to enforce hardware alignment if the user requests an
invalid format?
When the walign variable is computed at the start of this function, the
user's format->pixelformat hasn't been validated yet. If the format is
invalid, hdw_pixel_alignment() returns 0, leaving walign as 0.
When the invalid format is then overridden to fmt_default.pixelformat here,
walign is never recalculated. This allows the subsequent
v4l_bound_align_image() call to use walign = 0, which could result in an
unaligned bytesperline and stride.
Could this cause a WARN_ON() in dcmipp_capture_buf_prepare() and unaligned
memory accesses in the DMA engine?
[ ... ]
> @@ -580,7 +580,7 @@ static int dcmipp_bytecap_start_streaming(struct vb2_queue *vq,
>
> /*
> * Get source subdev - since link is IMMUTABLE, pointer is cached
> - * within the dcmipp_bytecap_device structure
> + * within the dcmipp_capture_device structure
> */
> if (!vcap->s_subdev) {
> pad = media_pad_remote_pad_first(&vcap->vdev.entity.pads[0]);
> if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> return -EINVAL;
[Severity: High]
This is a pre-existing issue, but does this early return leak queued buffers?
According to the videobuf2 API contract, if start_streaming fails, the driver
must return all queued buffers to the QUEUED state so userspace regains
ownership.
If media_pad_remote_pad_first() fails, this code returns -EINVAL directly
instead of going to the err_buffer_done label. This bypasses the cleanup path
and leaves the buffers stranded in vcap->buffers. Should this return be
changed to jump to a cleanup label?
[ ... ]
> @@ -1130,10 +1130,10 @@ static int dcmipp_name_to_pipe_id(const char *name)
> return -EINVAL;
> }
>
> -struct dcmipp_ent_device *dcmipp_bytecap_ent_init(const char *entity_name,
> +struct dcmipp_ent_device *dcmipp_capture_ent_init(const char *entity_name,
> struct dcmipp_device *dcmipp)
> {
> - struct dcmipp_bytecap_device *vcap;
> + struct dcmipp_capture_device *vcap;
> struct device *dev = dcmipp->dev;
> struct video_device *vdev;
> struct vb2_queue *q;
> const unsigned long pad_flag = MEDIA_PAD_FL_SINK;
> int ret = 0;
>
> /* Allocate the dcmipp_bytecap_device struct */
[Severity: Low]
This isn't a bug, but should this comment also be updated to reflect the
new dcmipp_capture_device structure name?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-stm32-dcmipp-pixel-pipes-support-v2-0-3c76b5f93157@foss.st.com?part=12
next prev parent reply other threads:[~2026-06-02 13:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 13:13 [PATCH v2 00/13] media: stm32: dcmipp: add support for MP2x pixel pipes Alain Volmat
2026-06-02 13:13 ` [PATCH v2 01/13] media: stm32: dcmipp: share struct dcmipp_device among subdevs Alain Volmat
2026-06-02 13:13 ` [PATCH v2 02/13] media: stm32: dcmipp: make dcmipp_state & cmsr2 read common Alain Volmat
2026-06-02 13:38 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 03/13] media: stm32: dcmipp: bytecap: protect CMIER register access Alain Volmat
2026-06-02 13:31 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 04/13] media: stm32: dcmipp: move common structures in dcmipp-common.h Alain Volmat
2026-06-02 13:14 ` [PATCH v2 05/13] media: stm32: dcmipp: correct swap in YUYV data with parallel input Alain Volmat
2026-06-02 13:30 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 06/13] media: stm32: dcmipp: configure csi input of all pipes on stm32mp25 Alain Volmat
2026-06-02 13:29 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 07/13] media: stm32: dcmipp: introduce a dcmipp global media_pipeline Alain Volmat
2026-06-02 13:14 ` [PATCH v2 08/13] media: stm32: dcmipp: add pixel pipes helper functions Alain Volmat
2026-06-02 13:14 ` [PATCH v2 09/13] media: stm32: dcmipp: addition of a dcmipp-isp subdev Alain Volmat
2026-06-02 13:29 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 10/13] media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev Alain Volmat
2026-06-02 13:32 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 11/13] media: stm32: dcmipp: add pixel-pipe support in bytecap Alain Volmat
2026-06-02 13:44 ` sashiko-bot
2026-06-02 13:14 ` [PATCH v2 12/13] media: stm32: dcmipp: rename bytecap into capture Alain Volmat
2026-06-02 13:39 ` sashiko-bot [this message]
2026-06-02 13:14 ` [PATCH v2 13/13] media: stm32: dcmipp: instantiate & link stm32mp25 subdevs Alain Volmat
2026-06-02 13:39 ` sashiko-bot
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=20260602133948.629B91F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alain.volmat@foss.st.com \
--cc=linux-media@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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