[Mesa-dev] [PATCH v1] i965: Prevent coverity warning

Robert Foss robert.foss at collabora.com
Mon Jan 30 22:55:41 UTC 2017


On 2017-01-30 05:37 PM, Timothy Arceri wrote:
> On Mon, 2017-01-30 at 16:27 -0500, Robert Foss wrote:
>> Add assert checking that num_sources is never larger than 3.
>>
>> This prevents Coverity from concluding that the improperly handled
>> cases of num_sources not being 0-3 are relevant.
>>
>> Coverity-Id: 1399480-1399489
>> Signed-off-by: Robert Foss <robert.foss at collabora.com>
>> ---
>>
>> Patch can be found here:
>>   https://git.collabora.com/cgit/user/robertfoss/mesa.git/log/?h=cov_
>> 1399480_1399489_v1
>>
>>  src/mesa/drivers/dri/i965/brw_eu_validate.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c
>> b/src/mesa/drivers/dri/i965/brw_eu_validate.c
>> index 226539445d..02e578e084 100644
>> --- a/src/mesa/drivers/dri/i965/brw_eu_validate.c
>> +++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c
>> @@ -177,6 +177,7 @@ num_sources_from_inst(const struct
>> gen_device_info *devinfo,
>>           return 0;
>>        }
>>     } else {
>> +      assert(desc->nsrc >= 4);
>
> This seems like the opposite of what you are describing in the commit
> message.
>
> Did you want?
>
> assert(desc->nsrc < 4);

Bah! Of course.


More information about the mesa-dev mailing list