mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
gpu: nvgpu: fix oob access in submit profiling dump
The number of samples has to be at least the number of percentile ranges (here 20) for the reporting to work as expected and also to not cause negative indices in reading the sorted profile data. If there are not enough samples, just report all zeroes. Change-Id: Ie893859d95074f5ceabf6abe873941873668861d Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1721892 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
c1b78dd65d
commit
794ddbd1a0
@@ -222,10 +222,11 @@ static unsigned int __gk20a_fifo_create_stats(struct gk20a *g,
|
||||
__profile_cmp, NULL);
|
||||
|
||||
/* build ranges */
|
||||
for (index = 0; index < PERCENTILE_RANGES; index++)
|
||||
percentiles[index] =
|
||||
for (index = 0; index < PERCENTILE_RANGES; index++) {
|
||||
percentiles[index] = nelem < PERCENTILE_RANGES ? 0 :
|
||||
g->fifo.profile.sorted[(PERCENTILE_WIDTH * (index + 1) *
|
||||
nelem)/100 - 1];
|
||||
}
|
||||
return nelem;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user