uninitialized variable in dcn10 code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2017-11-14 09:33 AM, Michel Dänzer wrote:
> On 14/11/17 01:29 PM, Tom St Denis wrote:
>> Hi Harry,
>>
>> At display/dc/dcn10/dcn10_hw_sequencer.c:2140
>>
>>     if (num_planes > 0) {
>>         struct dc_stream_state *stream_for_cursor;
>>
>>         program_all_pipe_in_tree(dc, top_pipe_to_program, context);
>>
>>         for (i = 0; i < dc->res_pool->pipe_count; i++) {
>>             struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
>>
>>             if (stream == pipe_ctx->stream) {
>>                 stream_for_cursor = pipe_ctx->stream;
>>                 break;
>>             }
>>         }
>>
>>         /* TODO: this is a hack w/a for switching from mpo to pipe split */
>>         if (stream_for_cursor->cursor_attributes.address.quad_part != 0) {
>>             struct dc_cursor_position position = { 0 };
>>
>>             dc_stream_set_cursor_position(stream_for_cursor, &position);
>>             dc_stream_set_cursor_attributes(stream_for_cursor,
>>                 &stream_for_cursor->cursor_attributes);
>>         }
>>     }
>>
>> The variable "stream_for_cursor" could be used uninitialized in the TODO
>> block.  The pointer should be probably initialized to NULL at the top.
> 
> BTW, the compiler points this out:
> 
> drivers/gpu/drm//amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c: In function â??dcn10_apply_ctx_for_surfaceâ??:
> drivers/gpu/drm//amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c:2146:5: warning: â??stream_for_cursorâ?? may be used uninitialized in this function [-Wmaybe-uninitialized]
>      &stream_for_cursor->cursor_attributes);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 

Yes, newer gcc (~5.8) does. We were still running Ubuntu 14.04 on our pre-submission build system and its gcc version didn't catch this. Jordan upgraded us to Ubuntu 16.04 with newer gcc that should catch this now.

Harry

> 


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux