[Mesa-dev] [PATCH] vl: Initialize pipe_vertex_buffer.user_buffer fields.

Christoph Bumiller e0425955 at student.tuwien.ac.at
Mon May 14 03:14:05 PDT 2012


On 14.05.2012 09:25, Jose Fonseca wrote:
> Looks good. Thanks Vinson.
>
> Joe

Actually, all the user_buffer pointers have a comment "/**< pointer to a
user buffer if buffer == NULL */", so you wouldn't actually have to
initialize them if buffer is guaranteed to be non-NULL, and checking for
user_buffer before buffer anywhere would be a bug ... but then, we can't
rely on people to recognize that, can we.

> ----- Original Message -----
>> Fix uninitialized scalar variable defects reported by Coverity.
>>
>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>> ---
>>  src/gallium/auxiliary/vl/vl_vertex_buffers.c |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
>> b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
>> index 1e326a1..a6e7af3 100644
>> --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
>> +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
>> @@ -56,6 +56,7 @@ vl_vb_upload_quads(struct pipe_context *pipe)
>>        PIPE_USAGE_STATIC,
>>        sizeof(struct vertex2f) * 4
>>     );
>> +   quad.user_buffer = NULL;
>>  
>>     if(!quad.buffer)
>>        return quad;
>> @@ -100,6 +101,7 @@ vl_vb_upload_pos(struct pipe_context *pipe,
>> unsigned width, unsigned height)
>>        PIPE_USAGE_STATIC,
>>        sizeof(struct vertex2s) * width * height
>>     );
>> +   pos.user_buffer = NULL;
>>  
>>     if(!pos.buffer)
>>        return pos;
>> @@ -268,6 +270,7 @@ vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer,
>> int component)
>>     buf.stride = sizeof(struct vl_ycbcr_block);
>>     buf.buffer_offset = 0;
>>     buf.buffer = buffer->ycbcr[component].resource;
>> +   buf.user_buffer = NULL;
>>  
>>     return buf;
>>  }
>> @@ -282,6 +285,7 @@ vl_vb_get_mv(struct vl_vertex_buffer *buffer, int
>> motionvector)
>>     buf.stride = sizeof(struct vl_motionvector);
>>     buf.buffer_offset = 0;
>>     buf.buffer = buffer->mv[motionvector].resource;
>> +   buf.user_buffer = NULL;
>>  
>>     return buf;
>>  }
>> --
>> 1.7.10.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list