drm/rockchip: fix a couple off by one bugs
Subsystems (5)
PATCH 1/1 drm/rockchip: fix a couple off by one bugs
The priv->crtc_funcs[] array has ROCKCHIP_MAX_CRTC elements so > should be >= here.
Fixes 2048e3286f34 ('drm: rockchip: Add basic drm driver')
Signed-off-by Dan Carpenter <[email protected]>
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2 -2
@@ -79,7 +79,7 @@ int rockchip_register_crtc_funcs(struct drm_crtc *crtc,int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return -EINVAL ; priv->crtc_funcs[pipe] = crtc_funcs;
@@ -92,7 +92,7 @@ void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return ; priv->crtc_funcs[pipe] =NULL ;
Quoted 6 lines · Dan Carpenter
The priv->crtc_funcs[] array has
ROCKCHIP_MAX_CRTCelements so > should be >= here.Fixes 2048e3286f34 ('drm: rockchip: Add basic drm driver')Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Sean Paul <[email protected]>
Quoted 26 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2
-2@@ -79,7 +79,7 @@ int rockchip_register_crtc_funcs(struct drm_crtc *crtc,int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return -EINVAL ; priv->crtc_funcs[pipe] = crtc_funcs;@@ -92,7 +92,7 @@ void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return ; priv->crtc_funcs[pipe] =NULL ;_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines · Dan Carpenter
The priv->crtc_funcs[] array has
ROCKCHIP_MAX_CRTCelements so > should be >= here.Fixes 2048e3286f34 ('drm: rockchip: Add basic drm driver')Signed-off-by Dan Carpenter <[email protected]>
Thanks for the fix, applied to my drm-fixes.
Quoted 25 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2
-2@@ -79,7 +79,7 @@ int rockchip_register_crtc_funcs(struct drm_crtc *crtc,int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return -EINVAL ; priv->crtc_funcs[pipe] = crtc_funcs;@@ -92,7 +92,7 @@ void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)int pipe =drm_crtc_index (crtc);struct rockchip_drm_private *priv = crtc->dev->dev_private; -if (pipe >ROCKCHIP_MAX_CRTC ) +if (pipe >=ROCKCHIP_MAX_CRTC )return ; priv->crtc_funcs[pipe] =NULL ;
Signature · 7 lines
Mark Yao -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html