[Mesa-dev] [PATCH 3/5] nvc0: make sure gmt programs are correctly validated

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Dec 14 08:02:34 PST 2015



On 12/14/2015 04:04 PM, Ilia Mirkin wrote:
> Instead take the return value and stick it into the if below.
> Returning early from these functions isn't something we generally want
> to do.

We already return at the same point for vertex programs, but I can 
definitely move this below.

>
> On Mon, Dec 14, 2015 at 5:14 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Spotted by Coverity.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
>> index 7e2e999..5e69e29 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
>> @@ -236,8 +236,10 @@ nvc0_gmtyprog_validate(struct nvc0_context *nvc0)
>>      struct nouveau_pushbuf *push = nvc0->base.pushbuf;
>>      struct nvc0_program *gp = nvc0->gmtyprog;
>>
>> -   if (gp)
>> -      nvc0_program_validate(nvc0, gp);
>> +   if (gp) {
>> +      if (!nvc0_program_validate(nvc0, gp))
>> +         return;
>> +   }
>>
>>      /* we allow GPs with no code for specifying stream output state only */
>>      if (gp && gp->code_size) {
>> --
>> 2.6.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
-Samuel


More information about the mesa-dev mailing list