Bug 97759

Summary: compile error bandwidth_calcs.c : array subscript is above array bounds [-Werror=array-bounds]
Product: DRI Reporter: kenneth johansson <ken>
Component: DRM/AMDgpu-proAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium    
Version: XOrg git   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dkms build log none

Description kenneth johansson 2016-09-10 00:30:01 UTC
when trying to install amdgpu-pro_16.30.3-315407.tar.xz on ubuntu 16.10 (Yakkety Yak)

/var/lib/dkms/amdgpu-pro/16.30.3-315407/build/make.log


  CC [M]  /var/lib/dkms/amdgpu-pro/16.30.3-315407/build/amd/amdgpu/../dal/dc/calcs/bandwidth_calcs.o
/var/lib/dkms/amdgpu-pro/16.30.3-315407/build/amd/amdgpu/../dal/dc/calcs/bandwidth_calcs.c: In function ‘calculate_bandwidth’:
/var/lib/dkms/amdgpu-pro/16.30.3-315407/build/amd/amdgpu/../dal/dc/calcs/bandwidth_calcs.c:3162:7: error: array subscript is above array bounds [-Werror=array-bounds]
       bw_max2(
       ^~~~~~~~
        results->blackout_recovery_time,

I looked at the code and gave up before even trying to understand it. the function call or macro was covering 43 lines. That is it's not a function that is implemented in 43 lines it's the actual call that is 43 lines of code.
Comment 1 kenneth johansson 2016-09-10 00:35:42 UTC
					results->blackout_recovery_time =
						bw_max2(
							results->blackout_recovery_time,
							bw_div(
								(bw_add(
									bw_mul(
										bw_div(
											bw_mul(
												results->display_bandwidth[k],
												results->useful_bytes_per_request[k]),
											results->bytes_per_request[k]),
										vbios->blackout_duration),
									bw_sub(
										bw_div(
											bw_mul(
												bw_mul(
													bw_mul(
														(bw_add(
															bw_add(
																bw_mul(
																	bw_int_to_fixed(
																		2),
																	vbios->mcifwrmc_urgent_latency),
																results->dmif_burst_time[i][j]),
															results->mcifwr_burst_time[results->y_clk_level][results->sclk_level])),
														results->dispclk),
													bw_int_to_fixed(
														results->bytes_per_pixel[k])),
												results->lines_interleaved_in_mem_access[k]),
											results->latency_hiding_lines[k]),
										results->adjusted_data_buffer_size[k]))),
								(bw_sub(
									bw_div(
										bw_mul(
											bw_mul(
												results->dispclk,
												bw_int_to_fixed(
													results->bytes_per_pixel[k])),
											results->lines_interleaved_in_mem_access[k]),
										results->latency_hiding_lines[k]),
									bw_div(
										bw_mul(
											results->display_bandwidth[k],
											results->useful_bytes_per_request[k]),
										results->bytes_per_request[k])))));
Comment 2 kenneth johansson 2016-09-10 00:37:03 UTC
Created attachment 126449 [details]
dkms build log
Comment 3 Jeremy Newton 2018-12-04 16:36:26 UTC
Closing, as this is pretty old, and only Ubuntu LTS is supported (e.g. 16.04, 18.04).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.