* [PATCH] drm/amd/display: Added pointer check
@ 2022-12-06 10:47 ` Denis Arefev
0 siblings, 0 replies; 6+ messages in thread
From: Denis Arefev @ 2022-12-06 10:47 UTC (permalink / raw)
To: Harry Wentland
Cc: Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
Pan, Xinhui, David Airlie, Daniel Vetter, Aurabindo Pillai,
Roman Li, Michel Dänzer, Fangzhi Zuo, amd-gfx, dri-devel,
linux-kernel, lvc-project, trufanov, vfh
Return value of a function 'dc_create_state' is
dereferenced at amdgpu_dm.c:2027 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0f7749e9424d..529483997154 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
dc_release_state(dm_state->context);
dm_state->context = dc_create_state(dm->dc);
/* TODO: Remove dc_state->dccg, use dc->dccg directly. */
- dc_resource_state_construct(dm->dc, dm_state->context);
+ if (dm_state->context) {
+ dc_resource_state_construct(dm->dc, dm_state->context);
+ }
/* Before powering on DC we need to re-initialize DMUB. */
r = dm_dmub_hw_init(adev);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/amd/display: Added pointer check
@ 2022-12-06 10:47 ` Denis Arefev
0 siblings, 0 replies; 6+ messages in thread
From: Denis Arefev @ 2022-12-06 10:47 UTC (permalink / raw)
To: Harry Wentland
Cc: trufanov, lvc-project, Leo Li, Pan, Xinhui, Rodrigo Siqueira,
Roman Li, amd-gfx, linux-kernel, vfh, Michel Dänzer,
Aurabindo Pillai, dri-devel, Fangzhi Zuo, Alex Deucher,
Christian König
Return value of a function 'dc_create_state' is
dereferenced at amdgpu_dm.c:2027 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0f7749e9424d..529483997154 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
dc_release_state(dm_state->context);
dm_state->context = dc_create_state(dm->dc);
/* TODO: Remove dc_state->dccg, use dc->dccg directly. */
- dc_resource_state_construct(dm->dc, dm_state->context);
+ if (dm_state->context) {
+ dc_resource_state_construct(dm->dc, dm_state->context);
+ }
/* Before powering on DC we need to re-initialize DMUB. */
r = dm_dmub_hw_init(adev);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/amd/display: Added pointer check
@ 2022-12-06 10:47 ` Denis Arefev
0 siblings, 0 replies; 6+ messages in thread
From: Denis Arefev @ 2022-12-06 10:47 UTC (permalink / raw)
To: Harry Wentland
Cc: trufanov, lvc-project, Leo Li, Pan, Xinhui, Rodrigo Siqueira,
Roman Li, amd-gfx, linux-kernel, vfh, Michel Dänzer,
Aurabindo Pillai, dri-devel, Daniel Vetter, Fangzhi Zuo,
Alex Deucher, David Airlie, Christian König
Return value of a function 'dc_create_state' is
dereferenced at amdgpu_dm.c:2027 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0f7749e9424d..529483997154 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
dc_release_state(dm_state->context);
dm_state->context = dc_create_state(dm->dc);
/* TODO: Remove dc_state->dccg, use dc->dccg directly. */
- dc_resource_state_construct(dm->dc, dm_state->context);
+ if (dm_state->context) {
+ dc_resource_state_construct(dm->dc, dm_state->context);
+ }
/* Before powering on DC we need to re-initialize DMUB. */
r = dm_dmub_hw_init(adev);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amd/display: Added pointer check
2022-12-06 10:47 ` Denis Arefev
(?)
@ 2022-12-06 10:59 ` Christian König
-1 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2022-12-06 10:59 UTC (permalink / raw)
To: Denis Arefev, Harry Wentland
Cc: trufanov, lvc-project, Leo Li, Pan, Xinhui, Rodrigo Siqueira,
Roman Li, amd-gfx, linux-kernel, vfh, Michel Dänzer,
Aurabindo Pillai, dri-devel, Fangzhi Zuo, Alex Deucher
Am 06.12.22 um 11:47 schrieb Denis Arefev:
> Return value of a function 'dc_create_state' is
> dereferenced at amdgpu_dm.c:2027 without checking for null
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 0f7749e9424d..529483997154 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
> dc_release_state(dm_state->context);
> dm_state->context = dc_create_state(dm->dc);
> /* TODO: Remove dc_state->dccg, use dc->dccg directly. */
> - dc_resource_state_construct(dm->dc, dm_state->context);
> + if (dm_state->context) {
> + dc_resource_state_construct(dm->dc, dm_state->context);
> + }
Single line statements shouldn't have an {} around them.
Apart from that I think error handling when dm_state->context can't be
created would be more appropriate, but that's something our display team
needs to look at.
Regards,
Christian.
>
> /* Before powering on DC we need to re-initialize DMUB. */
> r = dm_dmub_hw_init(adev);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amd/display: Added pointer check
@ 2022-12-06 10:59 ` Christian König
0 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2022-12-06 10:59 UTC (permalink / raw)
To: Denis Arefev, Harry Wentland
Cc: trufanov, lvc-project, Leo Li, Pan, Xinhui, Rodrigo Siqueira,
Roman Li, amd-gfx, linux-kernel, vfh, Michel Dänzer,
Aurabindo Pillai, dri-devel, Daniel Vetter, Fangzhi Zuo,
Alex Deucher, David Airlie
Am 06.12.22 um 11:47 schrieb Denis Arefev:
> Return value of a function 'dc_create_state' is
> dereferenced at amdgpu_dm.c:2027 without checking for null
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 0f7749e9424d..529483997154 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
> dc_release_state(dm_state->context);
> dm_state->context = dc_create_state(dm->dc);
> /* TODO: Remove dc_state->dccg, use dc->dccg directly. */
> - dc_resource_state_construct(dm->dc, dm_state->context);
> + if (dm_state->context) {
> + dc_resource_state_construct(dm->dc, dm_state->context);
> + }
Single line statements shouldn't have an {} around them.
Apart from that I think error handling when dm_state->context can't be
created would be more appropriate, but that's something our display team
needs to look at.
Regards,
Christian.
>
> /* Before powering on DC we need to re-initialize DMUB. */
> r = dm_dmub_hw_init(adev);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amd/display: Added pointer check
@ 2022-12-06 10:59 ` Christian König
0 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2022-12-06 10:59 UTC (permalink / raw)
To: Denis Arefev, Harry Wentland
Cc: Leo Li, Rodrigo Siqueira, Alex Deucher, Pan, Xinhui,
David Airlie, Daniel Vetter, Aurabindo Pillai, Roman Li,
Michel Dänzer, Fangzhi Zuo, amd-gfx, dri-devel,
linux-kernel, lvc-project, trufanov, vfh
Am 06.12.22 um 11:47 schrieb Denis Arefev:
> Return value of a function 'dc_create_state' is
> dereferenced at amdgpu_dm.c:2027 without checking for null
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 0f7749e9424d..529483997154 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
> dc_release_state(dm_state->context);
> dm_state->context = dc_create_state(dm->dc);
> /* TODO: Remove dc_state->dccg, use dc->dccg directly. */
> - dc_resource_state_construct(dm->dc, dm_state->context);
> + if (dm_state->context) {
> + dc_resource_state_construct(dm->dc, dm_state->context);
> + }
Single line statements shouldn't have an {} around them.
Apart from that I think error handling when dm_state->context can't be
created would be more appropriate, but that's something our display team
needs to look at.
Regards,
Christian.
>
> /* Before powering on DC we need to re-initialize DMUB. */
> r = dm_dmub_hw_init(adev);
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-12-06 22:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 10:47 [PATCH] drm/amd/display: Added pointer check Denis Arefev
2022-12-06 10:47 ` Denis Arefev
2022-12-06 10:47 ` Denis Arefev
2022-12-06 10:59 ` Christian König
2022-12-06 10:59 ` Christian König
2022-12-06 10:59 ` Christian König
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.