Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nihal Kumar Gupta" <nihal.gupta@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, linux-phy@lists.infradead.org,
	robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org,
	vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v2 6/8] media: qcom: camss: Add Hawi compatible camss driver
Date: Tue, 13 Oct 2026 11:51:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-169654@kernel.org> (raw)
In-Reply-To: <20261013-hawi-maili-camss-v2-6-fc93222da89c@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: camss: NULL deref in legacy init with malformed DT
--

commit ab588bfa99e7559381531b339a38e6b03af9609c
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: Add Hawi compatible camss driver

Add support for Hawi in the camss driver. Hawi reuses the CSIPHY
resource table from Kaanapali and the TPG resource table from
X1E80100.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 5db7e12a6f869..664237ad5ce60 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
[ ... ]
> @@ -6086,6 +6099,17 @@ static const struct camss_resources sm8650_resources = {
>  	.vfe_num = ARRAY_SIZE(vfe_res_sm8650),
>  };
>  
> +static const struct camss_resources hawi_resources = {
> +	.version = CAMSS_HAWI,
> +	.pd_name = "top",
> +	.csiphy_res = csiphy_res_kaanapali,

[Severity: High]
Can a malformed device tree without endpoints cause a NULL pointer
dereference when initializing this new compatible?

If a device tree node for Hawi is provided without endpoints,
camss_detect_legacy_phy() in drivers/media/platform/qcom/camss/camss.c
iterates over zero endpoints, leaving camss->legacy_phy = true:

camss_detect_legacy_phy() {
    ...
    camss->legacy_phy = true;

    /* Find first remote-endpoint and determine if its a PHY */
    for_each_endpoint_of_node(camss->dev->of_node, ep) {
    ...
}

camss_init_subdevices() then unconditionally calls
msm_csiphy_subdev_init_legacy(). Since the csiphy_res_kaanapali
structure reused here lacks a .hw_ops definition,
msm_csiphy_subdev_init_legacy() in
drivers/media/platform/qcom/camss/camss-csiphy.c will dereference
a NULL pointer:

msm_csiphy_subdev_init_legacy() {
    ...
    ret = csiphy->res->hw_ops->init(csiphy);
    ...
}

Should there be an explicit check for NULL hw_ops before dereferencing, or
should camss_detect_legacy_phy() handle cases with zero endpoints
differently so it fails gracefully instead of crashing?

> +	.tpg_res = tpg_res_x1e80100,
> +	.icc_res = icc_res_hawi,
> +	.icc_path_num = ARRAY_SIZE(icc_res_hawi),
> +	.csiphy_num = ARRAY_SIZE(csiphy_res_kaanapali),
> +	.tpg_num = ARRAY_SIZE(tpg_res_x1e80100),
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-hawi-maili-camss-v2-0-fc93222da89c@oss.qualcomm.com?part=6

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-10-13 11:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 11:02 [PATCH v2 0/8] Add CAMSS support for Qualcomm Hawi and Maili Nihal Kumar Gupta
2026-10-13 11:02 ` [PATCH v2 1/8] dt-bindings: i2c: qcom,i2c-cci: Add Hawi compatible Nihal Kumar Gupta
2026-10-13 12:24   ` Loic Poulain
2026-10-13 11:02 ` [PATCH v2 2/8] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Hawi and Maili compatibles Nihal Kumar Gupta
2026-10-13 11:02 ` [PATCH v2 3/8] dt-bindings: media: Add CAMSS device for Hawi Nihal Kumar Gupta
2026-10-13 11:19   ` sashiko-bot
2026-10-13 11:02 ` [PATCH v2 4/8] dt-bindings: media: Add CAMSS device for Maili Nihal Kumar Gupta
2026-10-13 11:24   ` sashiko-bot
2026-10-13 11:02 ` [PATCH v2 5/8] phy: qcom-mipi-csi2: Add Hawi support Nihal Kumar Gupta
2026-10-13 11:02 ` [PATCH v2 6/8] media: qcom: camss: Add Hawi compatible camss driver Nihal Kumar Gupta
2026-10-13 11:51   ` sashiko-bot [this message]
2026-10-13 11:02 ` [PATCH v2 7/8] media: qcom: camss: csid: Add support for CSID 1190 Nihal Kumar Gupta
2026-10-13 12:06   ` sashiko-bot
2026-10-13 11:02 ` [PATCH v2 8/8] media: qcom: camss: vfe: Add support for VFE 1190 Nihal Kumar Gupta

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=sashiko-outbox-169654@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=media-ci@linuxtv.org \
    --cc=neil.armstrong@linaro.org \
    --cc=nihal.gupta@oss.qualcomm.com \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@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