UPSTREAM: drm/msm/dsi: correct DSI id bounds check during registration
Check DSI instance id argument against the proper boundary size
to protect against invalid configuration of the DSI id.
Signed-off-by: Lloyd Atkinson <latkinso@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
(cherry picked from commit 6e1787cf45e48866c01dadc2a1b6c3d63d75b8d1)
Signed-off-by: Sean Paul <seanpaul@chromium.org>
BUG=b:109756482
TEST=Booted on cheza
Change-Id: I366c0038004b25787f314facab5f336024a58a57
Reviewed-on: https://chromium-review.googlesource.com/1089533
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Sean Paul <seanpaul@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 1a54fd6..4cb1cb6 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -862,7 +862,7 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
int id = msm_dsi->id;
int ret;
- if (id > DSI_MAX) {
+ if (id >= DSI_MAX) {
pr_err("%s: invalid id %d\n", __func__, id);
return -EINVAL;
}