Skip to content

Commit 3e41182

Browse files
SomeRandomToasterhdeller
authored andcommitted
fbdev: omapfb: Add 'plane' value check
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 <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent b204c29 commit 3e41182

File tree

1 file changed

+5
-1
lines changed
  • drivers/video/fbdev/omap2/omapfb/dss

1 file changed

+5
-1
lines changed

drivers/video/fbdev/omap2/omapfb/dss/dispc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2733,9 +2733,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
27332733
bool mem_to_mem)
27342734
{
27352735
int r;
2736-
enum omap_overlay_caps caps = dss_feat_get_overlay_caps(plane);
2736+
enum omap_overlay_caps caps;
27372737
enum omap_channel channel;
27382738

2739+
if (plane == OMAP_DSS_WB)
2740+
return -EINVAL;
2741+
2742+
caps = dss_feat_get_overlay_caps(plane);
27392743
channel = dispc_ovl_get_channel_out(plane);
27402744

27412745
DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->"

0 commit comments

Comments
 (0)