From: Stéphane Marchesin Date: Fri, 6 Sep 2013 17:45:27 +0000 (-0700) Subject: i915g: Fix initial array index X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7125af295751c504063644f61f19c0d70a6b1b3e;p=mesa.git i915g: Fix initial array index Fixes "Out-of-bounds read" defect reported by Coverity. --- 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++)