From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Damon Ding" <damon.ding@rock-chips.com>
Cc: heiko@sntech.de, dri-devel@lists.freedesktop.org,
dianders@chromium.org, Laurent.pinchart@ideasonboard.com,
andrzej.hajda@intel.com, airlied@gmail.com,
m.szyprowski@samsung.com, simona@ffwll.ch, robh@kernel.org,
rfoss@kernel.org, sebastian.reichel@collabora.com,
jernej.skrabec@gmail.com, linux-rockchip@lists.infradead.org,
devicetree@vger.kernel.org, conor+dt@kernel.org, jonas@kwiboo.se,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
linux-arm-kernel@lists.infradead.org,
dmitry.baryshkov@oss.qualcomm.com, neil.armstrong@linaro.org,
hjc@rock-chips.com, linux-kernel@vger.kernel.org,
tzimmermann@suse.de, andy.yan@rock-chips.com, krzk+dt@kernel.org,
nicolas.frattaroli@collabora.com
Subject: Re: [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung,lane-count property
Date: Sat, 30 May 2026 15:38:05 +0200 [thread overview]
Message-ID: <DIW1WGLL0GW5.1BGU194UXN0HO@bootlin.com> (raw)
In-Reply-To: <178014803941.21632.16225608049285101452.b4-review@b4>
On Sat May 30, 2026 at 3:33 PM CEST, Luca Ceresoli wrote:
> On Fri, 29 May 2026 12:05:29 +0800, Damon Ding <damon.ding@rock-chips.com> wrote:
>
> Hello Damon,
>
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> index 8cf6b73bceac..699a7f380c56 100644
>> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> @@ -1260,8 +1261,16 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp)
>> */
>> of_property_read_u32(dp_node, "samsung,link-rate",
>> &video_info->max_link_rate);
>> - of_property_read_u32(dp_node, "samsung,lane-count",
>> - &video_info->max_lane_count);
>> + ret = of_property_read_u32(dp_node, "samsung,lane-count",
>> + &video_info->max_lane_count);
>> + if (!ret) {
>> + if (video_info->max_lane_count == 0 ||
>> + video_info->max_lane_count > LANE_COUNT4) {
>
> This sashiko report seems to me valid.
Meh, messed up with 'b4 review' :-/ Apologies
"This sashiko report" [0] was about an enum being signed, so '== 0' could miss
negative numbers coming from bogus DT values higher than 1^31.
>
> But I'n no DP expert, I have no idea whether this ther one is valid.
And this was about "Additionally, does this check inadvertently allow 3,
which is an invalid DisplayPort lane count?"
>> + dev_err(dp->dev, "samsung,lane-count = %d is out of range\n",
>> + video_info->max_lane_count);
>> + return -EINVAL;
>> + }
>> + }
>
> As reported by sashiko, 'count == 0' should be 'count <= 0', being an enum.
>
> Additionally I'd avoid the nested if, and I think using dev_err_probe() is
> correct here (we are only called by probe functions), so it all could
> become:
>
> if (ret || count <= 0 || count > LANE_COUNT0)
> return dev_err_probe(...);
>
> There are other sashiko reports to patch 3, and at least one seems valid to
> me. Can you either fix them in the next iteration or elaborate on why the
> code is correct there?
>
> Thanks!
[0] https://sashiko.dev/#/patchset/20260529040530.741336-1-damon.ding%40rock-chips.com
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Damon Ding" <damon.ding@rock-chips.com>
Cc: <hjc@rock-chips.com>, <heiko@sntech.de>,
<andy.yan@rock-chips.com>, <maarten.lankhorst@linux.intel.com>,
<mripard@kernel.org>, <tzimmermann@suse.de>, <airlied@gmail.com>,
<simona@ffwll.ch>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <andrzej.hajda@intel.com>,
<neil.armstrong@linaro.org>, <rfoss@kernel.org>,
<Laurent.pinchart@ideasonboard.com>, <jonas@kwiboo.se>,
<jernej.skrabec@gmail.com>, <nicolas.frattaroli@collabora.com>,
<cristian.ciocaltea@collabora.com>,
<sebastian.reichel@collabora.com>,
<dmitry.baryshkov@oss.qualcomm.com>, <dianders@chromium.org>,
<m.szyprowski@samsung.com>, <dri-devel@lists.freedesktop.org>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-rockchip@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung,lane-count property
Date: Sat, 30 May 2026 15:38:05 +0200 [thread overview]
Message-ID: <DIW1WGLL0GW5.1BGU194UXN0HO@bootlin.com> (raw)
In-Reply-To: <178014803941.21632.16225608049285101452.b4-review@b4>
On Sat May 30, 2026 at 3:33 PM CEST, Luca Ceresoli wrote:
> On Fri, 29 May 2026 12:05:29 +0800, Damon Ding <damon.ding@rock-chips.com> wrote:
>
> Hello Damon,
>
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> index 8cf6b73bceac..699a7f380c56 100644
>> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> @@ -1260,8 +1261,16 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp)
>> */
>> of_property_read_u32(dp_node, "samsung,link-rate",
>> &video_info->max_link_rate);
>> - of_property_read_u32(dp_node, "samsung,lane-count",
>> - &video_info->max_lane_count);
>> + ret = of_property_read_u32(dp_node, "samsung,lane-count",
>> + &video_info->max_lane_count);
>> + if (!ret) {
>> + if (video_info->max_lane_count == 0 ||
>> + video_info->max_lane_count > LANE_COUNT4) {
>
> This sashiko report seems to me valid.
Meh, messed up with 'b4 review' :-/ Apologies
"This sashiko report" [0] was about an enum being signed, so '== 0' could miss
negative numbers coming from bogus DT values higher than 1^31.
>
> But I'n no DP expert, I have no idea whether this ther one is valid.
And this was about "Additionally, does this check inadvertently allow 3,
which is an invalid DisplayPort lane count?"
>> + dev_err(dp->dev, "samsung,lane-count = %d is out of range\n",
>> + video_info->max_lane_count);
>> + return -EINVAL;
>> + }
>> + }
>
> As reported by sashiko, 'count == 0' should be 'count <= 0', being an enum.
>
> Additionally I'd avoid the nested if, and I think using dev_err_probe() is
> correct here (we are only called by probe functions), so it all could
> become:
>
> if (ret || count <= 0 || count > LANE_COUNT0)
> return dev_err_probe(...);
>
> There are other sashiko reports to patch 3, and at least one seems valid to
> me. Can you either fix them in the next iteration or elaborate on why the
> code is correct there?
>
> Thanks!
[0] https://sashiko.dev/#/patchset/20260529040530.741336-1-damon.ding%40rock-chips.com
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-05-30 13:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 4:05 [PATCH v4 0/3] Add eDP lane mapping support Damon Ding
2026-05-29 4:05 ` Damon Ding
2026-05-29 4:05 ` [PATCH v4 1/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding
2026-05-29 4:05 ` Damon Ding
2026-05-29 4:46 ` sashiko-bot
2026-05-29 16:43 ` Conor Dooley
2026-05-29 16:43 ` Conor Dooley
2026-06-01 11:55 ` Sebastian Reichel
2026-06-01 11:55 ` Sebastian Reichel
2026-05-29 4:05 ` [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung, lane-count property Damon Ding
2026-05-29 4:05 ` [PATCH v4 2/3] drm/bridge: analogix_dp: Add validation for samsung,lane-count property Damon Ding
2026-05-29 4:05 ` Damon Ding
2026-05-29 5:31 ` sashiko-bot
2026-05-30 13:33 ` Luca Ceresoli
2026-05-30 13:33 ` Luca Ceresoli
2026-05-30 13:38 ` Luca Ceresoli [this message]
2026-05-30 13:38 ` Luca Ceresoli
2026-06-01 2:59 ` Damon Ding
2026-06-01 2:59 ` Damon Ding
2026-06-01 12:02 ` Luca Ceresoli
2026-06-01 12:02 ` Luca Ceresoli
2026-06-01 12:24 ` Damon Ding
2026-06-01 12:24 ` Damon Ding
2026-05-29 4:05 ` [PATCH v4 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding
2026-05-29 4:05 ` Damon Ding
2026-05-29 5:56 ` sashiko-bot
2026-06-01 11:59 ` Sebastian Reichel
2026-06-01 11:59 ` Sebastian Reichel
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=DIW1WGLL0GW5.1BGU194UXN0HO@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=damon.ding@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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.