Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 02/16] media: iris: Filter UBWC raw formats based on hardware capabilities
Date: Tue, 16 Jun 2026 00:17:32 +0000	[thread overview]
Message-ID: <20260616001733.5FC251F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616-iris-ar50lt-v5-2-583b42770b6a@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The `iris_vdec_formats_noubwc_cap` array contains a zero-initialized gap at index 1, which prematurely terminates V4L2 format enumeration and improperly validates 0 as a valid pixel format.
--

commit 1ff6b6e464175bc1ccf6878e0aa89ffec126608b
Author: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>

media: iris: Filter UBWC raw formats based on hardware capabilities

The raw formats supported by Iris were previously advertised
unconditionally, assuming UBWC support on all platforms. Use the UBWC
configuration provided by the platform to dynamically filter raw formats
at runtime, keeping linear formats available when UBWC is not supported.

> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
> index 9e228b70420e4..63b7c9dec60a0 100644
> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
[ ... ]
> @@ -69,8 +70,14 @@ static const u32 iris_vdec_formats_cap[] = {
>  	[IRIS_FMT_QC10C] =  V4L2_PIX_FMT_QC10C,
>  };
>  
> +static const u32 iris_vdec_formats_noubwc_cap[] = {
> +	[IRIS_FMT_NV12] = V4L2_PIX_FMT_NV12,
> +	[IRIS_FMT_TP10] =  V4L2_PIX_FMT_P010,
> +};

[Severity: High]
Does this create a sparse array with a zero-initialized gap at index 1?

Because IRIS_FMT_NV12 is 0 and IRIS_FMT_TP10 is 2, skipping index 1 
(IRIS_FMT_QC08C) implicitly initializes it to 0.

When check_format() in iris_vdec.c iterates through this array:

	for (i = 0; i < size; i++) {
		if (fmt[i] == pixfmt)
			break;
	}

Won't it incorrectly accept 0 as a valid pixel format by matching against the
uninitialized gap?

[ ... ]
> @@ -110,6 +122,7 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)
>  
>  static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type)
>  {
> +	const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;
>  	unsigned int size;
>  	const u32 *fmt;
>  
> @@ -119,8 +132,13 @@ static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type)
>  		size = inst->core->iris_platform_data->inst_iris_fmts_size;
>  		break;
>  	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
> -		fmt = iris_vdec_formats_cap;
> -		size = ARRAY_SIZE(iris_vdec_formats_cap);
> +		if (ubwc->ubwc_enc_version) {
> +			fmt = iris_vdec_formats_cap;
> +			size = ARRAY_SIZE(iris_vdec_formats_cap);
> +		} else {
> +			fmt = iris_vdec_formats_noubwc_cap;
> +			size = ARRAY_SIZE(iris_vdec_formats_noubwc_cap);
> +		}
>  		break;
>  	default:
>  		return 0;

[Severity: High]
Will the V4L2 enumeration stop prematurely when encountering the gap?

Since the V4L2 framework queries formats using a sequential index, querying
index 1 will hit the zero-initialized hole, causing find_format_by_index()
in iris_vdec.c to return 0.

When 0 is returned, V4L2 typically stops enumeration, meaning the valid 10-bit
linear format (V4L2_PIX_FMT_P010) at index 2 will be completely hidden.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260616-iris-ar50lt-v5-0-583b42770b6a@oss.qualcomm.com?part=2

  reply	other threads:[~2026-06-16  0:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  0:04 [PATCH v5 00/16] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 01/16] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 02/16] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-06-16  0:17   ` sashiko-bot [this message]
2026-06-16  0:32     ` Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 03/16] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 04/16] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 05/16] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-06-16  0:16   ` sashiko-bot
2026-06-16  0:04 ` [PATCH v5 06/16] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 07/16] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 08/16] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 09/16] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-06-16  2:17   ` sashiko-bot
2026-06-16  0:04 ` [PATCH v5 10/16] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-06-16  0:20   ` sashiko-bot
2026-06-16  0:04 ` [PATCH v5 11/16] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-06-16  0:20   ` sashiko-bot
2026-06-16  0:04 ` [PATCH v5 12/16] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-06-16  0:40   ` sashiko-bot
2026-06-16  0:04 ` [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-06-16  0:21   ` sashiko-bot
2026-06-16  0:30     ` Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 14/16] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-06-16  0:26   ` sashiko-bot
2026-06-16  0:31     ` Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 15/16] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-06-16  0:04 ` [PATCH v5 16/16] media: iris: constify inst_fw_cap_sm8250_dec Dmitry Baryshkov

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=20260616001733.5FC251F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=robh@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