2020-01-08 22:44:42

by Tobias Schramm

[permalink] [raw]
Subject: [PATCH 0/1] Regression in rockchipdrm

commit 2589c4025f13 ("drm/rockchip: Avoid drm_dp_link helpers") changed
the datatype used for storing the display port data rate to u8.
A u8 is not sufficient to store the data rate, resulting in a crash due
to incorrect calculations.

This series resolves the issue by restoring the data types changed in
commit 2589c4025f13 to their original type.

Tobias Schramm (1):
drm/rockchip: fix integer type used for storing dp data rate and lane
count

drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--
2.24.1


2020-01-08 22:45:21

by Tobias Schramm

[permalink] [raw]
Subject: [PATCH 1/1] drm/rockchip: fix integer type used for storing dp data rate and lane count

commit 2589c4025f13 ("drm/rockchip: Avoid drm_dp_link helpers") changes
the type of variables used to store the display port data rate and
number of lanes to u8. However u8 is not sufficient to store the link
data rate of the display port.
This commit reverts the type of both the number of lanes and the data
rate to unsigned int.

Signed-off-by: Tobias Schramm <[email protected]>
---
drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h
index 83c4586665b4..806cb0b08982 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.h
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h
@@ -94,8 +94,8 @@ struct cdn_dp_device {
struct video_info video_info;
struct cdn_dp_port *port[MAX_PHY];
u8 ports;
- u8 max_lanes;
- u8 max_rate;
+ unsigned int max_lanes;
+ unsigned int max_rate;
u8 lanes;
int active_port;

--
2.24.1

2020-01-09 00:16:46

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH 1/1] drm/rockchip: fix integer type used for storing dp data rate and lane count

Am Mittwoch, 8. Januar 2020, 23:39:49 CET schrieb Tobias Schramm:
> commit 2589c4025f13 ("drm/rockchip: Avoid drm_dp_link helpers") changes
> the type of variables used to store the display port data rate and
> number of lanes to u8. However u8 is not sufficient to store the link
> data rate of the display port.
> This commit reverts the type of both the number of lanes and the data
> rate to unsigned int.
>
> Signed-off-by: Tobias Schramm <[email protected]>
> ---
> drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h
> index 83c4586665b4..806cb0b08982 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h
> @@ -94,8 +94,8 @@ struct cdn_dp_device {
> struct video_info video_info;
> struct cdn_dp_port *port[MAX_PHY];
> u8 ports;
> - u8 max_lanes;
> - u8 max_rate;
> + unsigned int max_lanes;

although I would think u8 should be enough for max_lanes?
There shouldn't be be more than 255 dp lanes?


Heiko

> + unsigned int max_rate;
> u8 lanes;
> int active_port;
>
>




2020-01-09 06:59:40

by Tobias Schramm

[permalink] [raw]
Subject: Re: [PATCH 1/1] drm/rockchip: fix integer type used for storing dp data rate and lane count

Am 09.01.20 um 01:15 schrieb Heiko Stübner:
> Am Mittwoch, 8. Januar 2020, 23:39:49 CET schrieb Tobias Schramm:
>> commit 2589c4025f13 ("drm/rockchip: Avoid drm_dp_link helpers") changes
>> the type of variables used to store the display port data rate and
>> number of lanes to u8. However u8 is not sufficient to store the link
>> data rate of the display port.
>> This commit reverts the type of both the number of lanes and the data
>> rate to unsigned int.
>>
>> Signed-off-by: Tobias Schramm <[email protected]>
>> ---
>> drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h
>> index 83c4586665b4..806cb0b08982 100644
>> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h
>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h
>> @@ -94,8 +94,8 @@ struct cdn_dp_device {
>> struct video_info video_info;
>> struct cdn_dp_port *port[MAX_PHY];
>> u8 ports;
>> - u8 max_lanes;
>> - u8 max_rate;
>> + unsigned int max_lanes;
>
> although I would think u8 should be enough for max_lanes?
> There shouldn't be be more than 255 dp lanes?

True. I'll test and send a v2.

Thanks, Tobias

>
> Heiko
>
>> + unsigned int max_rate;
>> u8 lanes;
>> int active_port;
>>
>>
>
>
>
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>