OSDN Git Service

radeonsi: fix range checking for state regs
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Sep 2012 16:09:16 +0000 (12:09 -0400)
committerChristian König <deathsimple@vodafone.de>
Mon, 1 Oct 2012 08:29:50 +0000 (10:29 +0200)
end value is exclusive, but in practice we shouldn't
hit this.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/drivers/radeonsi/radeonsi_pm4.c

index ea0a1bd..79a2521 100644 (file)
@@ -57,17 +57,18 @@ void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
 {
        unsigned opcode;
 
-       if (reg >= SI_CONFIG_REG_OFFSET && reg <= SI_CONFIG_REG_END) {
+       if (reg >= SI_CONFIG_REG_OFFSET && reg < SI_CONFIG_REG_END) {
                opcode = PKT3_SET_CONFIG_REG;
                reg -= SI_CONFIG_REG_OFFSET;
 
-       } else if (reg >= SI_SH_REG_OFFSET && reg <= SI_SH_REG_END) {
+       } else if (reg >= SI_SH_REG_OFFSET && reg < SI_SH_REG_END) {
                opcode = PKT3_SET_SH_REG;
                reg -= SI_SH_REG_OFFSET;
 
-       } else if (reg >= SI_CONTEXT_REG_OFFSET && reg <= SI_CONTEXT_REG_END) {
+       } else if (reg >= SI_CONTEXT_REG_OFFSET && reg < SI_CONTEXT_REG_END) {
                opcode = PKT3_SET_CONTEXT_REG;
                reg -= SI_CONTEXT_REG_OFFSET;
+
        } else {
                R600_ERR("Invalid register offset %08x!\n", reg);
                return;