* [PATCH 1/2] fbdev: omapfb: Remove writeback deadcode
@ 2025-03-18 21:19 Leonid Arapov
2025-03-18 21:19 ` [PATCH 29/29] fbdev: omapfb: Add 'plane' value check Leonid Arapov
0 siblings, 1 reply; 2+ messages in thread
From: Leonid Arapov @ 2025-03-18 21:19 UTC (permalink / raw)
To: Helge Deller
Cc: Leonid Arapov, Krzysztof Kozlowski, Dr. David Alan Gilbert,
Uwe Kleine-König, linux-omap, linux-fbdev, dri-devel,
linux-kernel, lvc-project
Value of enum parameter 'plane' is initialized in dss_init_overlays and
cannot take the value OMAP_DSS_WB. Function dispc_ovl_setup_common could
be called with this value of parameter only from dispc_wb_setup, which has
never been used and has been removed in commit 4f55bb03801a
("omapfb: Remove unused writeback code"). The code in the if-branch is
unreachable.
Remove unreachable branch.
Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.
Signed-off-by: Leonid Arapov <arapovl839@gmail.com>
---
drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
index ccb96a5be07e..8db074862824 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
@@ -2659,13 +2659,8 @@ static int dispc_ovl_setup_common(enum omap_plane plane,
row_inc = 0;
pix_inc = 0;
- if (plane == OMAP_DSS_WB) {
- frame_width = out_width;
- frame_height = out_height;
- } else {
- frame_width = in_width;
- frame_height = height;
- }
+ frame_width = in_width;
+ frame_height = height;
if (rotation_type == OMAP_DSS_ROT_TILER)
calc_tiler_rotation_offset(screen_width, frame_width,
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 29/29] fbdev: omapfb: Add 'plane' value check
2025-03-18 21:19 [PATCH 1/2] fbdev: omapfb: Remove writeback deadcode Leonid Arapov
@ 2025-03-18 21:19 ` Leonid Arapov
0 siblings, 0 replies; 2+ messages in thread
From: Leonid Arapov @ 2025-03-18 21:19 UTC (permalink / raw)
To: Helge Deller
Cc: Leonid Arapov, Krzysztof Kozlowski, Dr. David Alan Gilbert,
Uwe Kleine-König, linux-omap, linux-fbdev, dri-devel,
linux-kernel, lvc-project
Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB
of the enum parameter plane.
The value of this parameter is initialized in dss_init_overlays and in the
current state of the code it cannot take this value so it's not a real
problem.
For the purposes of defensive coding it wouldn't be superfluous to check
the parameter value, because some functions down the call stack process
this value correctly and some not.
For example, in dispc_ovl_setup_global_alpha it may lead to buffer
overflow.
Add check for this value.
Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.
Signed-off-by: Leonid Arapov <arapovl839@gmail.com>
---
drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
index 8db074862824..1dc70c96d813 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c
@@ -2733,9 +2733,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
bool mem_to_mem)
{
int r;
- enum omap_overlay_caps caps = dss_feat_get_overlay_caps(plane);
+ enum omap_overlay_caps caps;
enum omap_channel channel;
+ if (plane == OMAP_DSS_WB)
+ return -EINVAL;
+
+ caps = dss_feat_get_overlay_caps(plane);
channel = dispc_ovl_get_channel_out(plane);
DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->"
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-18 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 21:19 [PATCH 1/2] fbdev: omapfb: Remove writeback deadcode Leonid Arapov
2025-03-18 21:19 ` [PATCH 29/29] fbdev: omapfb: Add 'plane' value check Leonid Arapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox