aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 189e86522b5b..a134790903d3 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -428,7 +428,7 @@ static inline int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u3
428 last_reg = ARRAY_SIZE(evergreen_reg_safe_bm); 428 last_reg = ARRAY_SIZE(evergreen_reg_safe_bm);
429 429
430 i = (reg >> 7); 430 i = (reg >> 7);
431 if (i > last_reg) { 431 if (i >= last_reg) {
432 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx); 432 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx);
433 return -EINVAL; 433 return -EINVAL;
434 } 434 }
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index db8ef1905d5f..cf83aa05a684 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -915,12 +915,11 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx
915{ 915{
916 struct r600_cs_track *track = (struct r600_cs_track *)p->track; 916 struct r600_cs_track *track = (struct r600_cs_track *)p->track;
917 struct radeon_cs_reloc *reloc; 917 struct radeon_cs_reloc *reloc;
918 u32 last_reg = ARRAY_SIZE(r600_reg_safe_bm);
919 u32 m, i, tmp, *ib; 918 u32 m, i, tmp, *ib;
920 int r; 919 int r;
921 920
922 i = (reg >> 7); 921 i = (reg >> 7);
923 if (i > last_reg) { 922 if (i >= ARRAY_SIZE(r600_reg_safe_bm)) {
924 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx); 923 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx);
925 return -EINVAL; 924 return -EINVAL;
926 } 925 }