From 7125af295751c504063644f61f19c0d70a6b1b3e Mon Sep 17 00:00:00 2001 From: Stéphane Marchesin Date: Fri, 6 Sep 2013 10:45:27 -0700 Subject: i915g: Fix initial array index Fixes "Out-of-bounds read" defect reported by Coverity. --- src/gallium/drivers/i915/i915_state_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c index 9c16e590003..71ac326c4d8 100644 --- a/src/gallium/drivers/i915/i915_state_emit.c +++ b/src/gallium/drivers/i915/i915_state_emit.c @@ -142,7 +142,7 @@ static uint target_fixup(struct pipe_surface *p, int component) { PIPE_FORMAT_A8_UNORM, { 0, 0, 0, S5_WRITEDISABLE_RED | S5_WRITEDISABLE_GREEN | S5_WRITEDISABLE_BLUE | S5_WRITEDISABLE_ALPHA}}, { 0, { S5_WRITEDISABLE_RED, S5_WRITEDISABLE_GREEN, S5_WRITEDISABLE_BLUE, S5_WRITEDISABLE_ALPHA}} }; - int i = sizeof(fixup_mask) / sizeof(*fixup_mask); + int i = sizeof(fixup_mask) / sizeof(*fixup_mask) - 1; if (p) for(i = 0; fixup_mask[i].format != 0; i++) -- cgit v1.2.3