[Mesa-dev] [PATCH 14/16] main: Added entry point for glCreateRenderbuffers
Ilia Mirkin
imirkin at alum.mit.edu
Thu Mar 26 22:13:32 PDT 2015
On Fri, Mar 27, 2015 at 1:06 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> On Mon, Feb 16, 2015 at 6:14 AM, Martin Peres
> <martin.peres at linux.intel.com> wrote:
>> @@ -1404,14 +1405,36 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
>> for (i = 0; i < n; i++) {
>> GLuint name = first + i;
>> renderbuffers[i] = name;
>> - /* insert dummy placeholder into hash table */
>> +
>> + if (dsa) {
>> + obj = _mesa_new_renderbuffer(ctx, name);
>> + } else {
>> + obj = &DummyRenderbuffer;
>> + }
>> + /* insert the object into the hash table */
>> mtx_lock(&ctx->Shared->Mutex);
>> - _mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer);
>> + _mesa_HashInsert(ctx->Shared->RenderBuffers, name, obj);
>> mtx_unlock(&ctx->Shared->Mutex);
>> }
>> }
>>
>
> This patch introduced a new Coverity unused value defect.
>
> returned_pointer: Assigning value from allocate_renderbuffer(ctx,
> name, func) to obj here, but that stored value is overwritten before
> it can be used.
Yeah, I mentioned this to Martin privately. Actually the patch above
is fine. However I'm guessing that on rebasing, it became this:
if (dsa) {
obj = allocate_renderbuffer(ctx, name, func);
} else {
obj = &DummyRenderbuffer;
/* insert the object into the hash table */
mtx_lock(&ctx->Shared->Mutex);
_mesa_HashInsert(ctx->Shared->RenderBuffers, name, obj);
mtx_unlock(&ctx->Shared->Mutex);
}
Which seems quite wrong -- we should move the closing } above the hash
insertion, I would imagine.
-ilia
More information about the mesa-dev
mailing list