drm/msm/dpu: Fix uninitialized variable
PATCH v2 1/1 drm/msm/dpu: Fix uninitialized variable
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3 -4
@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];
@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible)continue ; - ret =dpu_plane_virtual_assign_resources (crtc, global_state, +int ret =dpu_plane_virtual_assign_resources (crtc, global_state, state, plane_state);if (ret) -break ; +return ret; } -return ret; +return 0 ; }static void dpu_plane_flush_csc (struct dpu_plane *pdpu,struct dpu_sw_pipe *pipe)
---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617
Best regards,
Signature · 1 line
Ethan Carter Edwards <[email protected]>
Quoted 8 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>
Quoted 9 lines
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Quoted 8 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>
Quoted 9 lines
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Thanks for your patch, this was addressed with
https://patchwork.freedesktop.org/patch/631567/ but since this is better I am fine with this, will pick this one up
Quoted 35 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3
-5@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible)continue ; - ret =dpu_plane_virtual_assign_resources (crtc, global_state, +int ret =dpu_plane_virtual_assign_resources (crtc, global_state, state, plane_state);if (ret) -break ; +return ret; } -return ret; +return 0 ; }static void dpu_plane_flush_csc (struct dpu_plane *pdpu,struct dpu_sw_pipe *pipe) ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Marijn Suijten
reviewerQuoted 21 lines · Abhinav Kumar
Quoted 8 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>Quoted 9 lines
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Quoted 4 lines
Thanks for your patch, this was addressed with
https://patchwork.freedesktop.org/patch/631567/ but since this is better I am fine with this, will pick this one up
The return 0; in this patch should certainly fix this issue entirely and we don't need to inline the int ret for that, which I think is against mixed declaration rules anyway?
As far as I understand that's what Dmitry suggested in v1, but he r-b'd it in this form. Dmitry, was that intended?
- Marijn
Quoted 39 lines
Reviewed-by Abhinav Kumar <[email protected]>Quoted 35 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3
-5@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible)continue ; - ret =dpu_plane_virtual_assign_resources (crtc, global_state, +int ret =dpu_plane_virtual_assign_resources (crtc, global_state, state, plane_state);if (ret) -break ; +return ret; } -return ret; +return 0 ; }static void dpu_plane_flush_csc (struct dpu_plane *pdpu,struct dpu_sw_pipe *pipe) ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Quoted 27 lines · Marijn Suijten
Quoted 21 lines · Abhinav Kumar
Quoted 8 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>Quoted 9 lines
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)Quoted 4 lines
Thanks for your patch, this was addressed with
https://patchwork.freedesktop.org/patch/631567/ but since this is better I am fine with this, will pick this one up
Quoted 6 lines
The
return 0;in this patch should certainly fix this issue entirely and we don't need to inline theint retfor that, which I think is against mixed declaration rules anyway?As far as I understand that's what Dmitry suggested in v1, but he r-b'd it in this form. Dmitry, was that intended?
I think it should be fine, if the gcc doesn't warn against it.
Quoted 42 lines
- Marijn
Quoted 39 lines
Reviewed-by Abhinav Kumar <[email protected]>Quoted 35 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3
-5@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible)continue ; - ret =dpu_plane_virtual_assign_resources (crtc, global_state, +int ret =dpu_plane_virtual_assign_resources (crtc, global_state, state, plane_state);if (ret) -break ; +return ret; } -return ret; +return 0 ; }static void dpu_plane_flush_csc (struct dpu_plane *pdpu,struct dpu_sw_pipe *pipe) ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Signature · 2 lines
With best wishes Dmitry
Quoted 28 lines · Dmitry Baryshkov
Quoted 27 lines · Marijn Suijten
Quoted 25 lines · Abhinav Kumar
Quoted 8 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>Quoted 9 lines
---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)Thanks for your patch, this was addressed with
https://patchwork.freedesktop.org/patch/631567/ but since this is better I am fine with this, will pick this one up
Quoted 9 lines
Quoted 6 lines
The
return 0;in this patch should certainly fix this issue entirely and we don't need to inline theint retfor that, which I think is against mixed declaration rules anyway?As far as I understand that's what Dmitry suggested in v1, but he r-b'd it in this form. Dmitry, was that intended?
I think it should be fine, if the gcc doesn't warn against it.
Let me test out the compilation while applying and see if it throws any errors. If it does, will report here and we can go with the other patch.
Quoted 43 lines
Quoted 42 lines
- Marijn
Quoted 39 lines
Reviewed-by Abhinav Kumar <[email protected]>Quoted 35 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3
-5@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible)continue ; - ret =dpu_plane_virtual_assign_resources (crtc, global_state, +int ret =dpu_plane_virtual_assign_resources (crtc, global_state, state, plane_state);if (ret) -break ; +return ret; } -return ret; +return 0 ; }static void dpu_plane_flush_csc (struct dpu_plane *pdpu,struct dpu_sw_pipe *pipe) ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Quoted 36 lines · Abhinav Kumar
Quoted 33 lines · Dmitry Baryshkov
Quoted 32 lines · Marijn Suijten
Quoted 22 lines · Abhinav Kumar
Quoted 16 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>---
Changes in v2:
- Return explicit 0 when no error occurs
- Add hardening mailing lists
- Link to v1: https://lore.kernel.org/r/20250209-dpu-
[email protected]
---
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c| 7 +++----Quoted 2 lines
1 file changed, 3 insertions(+), 4 deletions(-)Quoted 4 lines
Thanks for your patch, this was addressed with
https://patchwork.freedesktop.org/patch/631567/ but since this is better I am fine with this, will pick this one up
The
return 0;in this patch should certainly fix this issue entirely and we don't need to inline theint retfor that, which I think is against mixed declaration rules anyway?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
As far as I understand that's what Dmitry suggested in v1, but he r- b'd it in this form. Dmitry, was that intended?
I think it should be fine, if the gcc doesn't warn against it.
Let me test out the compilation while applying and see if it throws any errors. If it does, will report here and we can go with the other patch.
On my end, compilation looks fine, so will pickup this version.
Thanks
Abhinav
Quoted 43 lines
Quoted 42 lines
Quoted 41 lines
- Marijn
Quoted 38 lines
Reviewed-by Abhinav Kumar <[email protected]>Quoted 34 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3
-5@@ -1164,7 +1164,6 @@ int dpu_assign_plane_resources(structdpu_global_state *global_state, unsigned int num_planes) { unsigned int i; - int ret; for (i = 0; i < num_planes; i++) { struct drm_plane_state *plane_state = states[i];@@ -1173,13 +1172,13 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, !plane_state->visible) continue; - ret = dpu_plane_virtual_assign_resources(crtc, global_state, + int ret = dpu_plane_virtual_assign_resources(crtc, global_state, state, plane_state); if (ret) - break; + return ret; } - return ret; + return 0; } static void dpu_plane_flush_csc(struct dpu_plane *pdpu, struct dpu_sw_pipe *pipe) ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Abhinav Kumar
AppliedRe: (subset) [PATCH v2] drm/msm/dpu: Fix uninitialized variable
In reply to Ethan Carter EdwardsQuoted 6 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Applied to msm-fixes, thanks!
[1/1] drm/msm/dpu: Fix uninitialized variable
https://gitlab.freedesktop.org/drm/msm/-/commit/978ca99d6bd8
Best regards,
Signature · 1 line
Abhinav Kumar <[email protected]>