[bug report] drm/amdgpu/display: Add core dc support for DCN

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

 



Hello Harry Wentland,

The patch 70ccab604049: "drm/amdgpu/display: Add core dc support for
DCN" from May 8, 2017, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c:1696 dcn10_translate_regamma_to_hw_format()
	warn: potential off by one (named limit 'MAX_REGIONS_NUMBER') 'seg_distr[k]'

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c
  1560          int32_t segment_start, segment_end;
  1561          int32_t i;
  1562          uint32_t j, k, seg_distr[MAX_REGIONS_NUMBER], increment, start_index, hw_points;
                                         ^^^^^^^^^^^^^^^^^^^
[ snip ]

  1684          i = 1;
  1685          for (k = 0; k < MAX_REGIONS_NUMBER && i < MAX_REGIONS_NUMBER; k++) {
                            ^^^^^^^^^^^^^^^^^^^^^^
  1686                  if (seg_distr[k] != -1) {
  1687                          regamma_params->arr_curve_points[k].segments_num =
  1688                                          seg_distr[k];
  1689                          regamma_params->arr_curve_points[i].offset =
  1690                                          regamma_params->arr_curve_points[k].
  1691                                          offset + (1 << seg_distr[k]);
  1692                  }
  1693                  i++;
  1694          }
  1695  
  1696          if (seg_distr[k] != -1)
                    ^^^^^^^^^^^^
If k == MAX_REGIONS_NUMBER then we're reading beyond the end of the array

  1697                  regamma_params->arr_curve_points[k].segments_num =
  1698                                  seg_distr[k];
  1699  

regards,
dan carpenter


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

  Powered by Linux