diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-08-15 15:58:54 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-07 23:07:11 -0400 |
commit | 70c4496ca7add205f604c5c7fec8c16033394ba0 (patch) | |
tree | 9309a4a3c3e7cd04bf7c424ea8a30c843f1619ca /drivers/gpu/nvgpu | |
parent | 2dcfd29861f2c5dc75cff988e7d950e15aad9da2 (diff) |
gpu: nvgpu: Fix blockcount in lockless allocator
Make sure that the block count is the length / block_size since the
length is passed in bytes.
Change-Id: Ibb132b16b70b9cd7117c441f37a7947052d279ee
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1538976
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index 0df1ae9d..a7772b6b 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c | |||
@@ -168,7 +168,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, | |||
168 | * Ensure we have space for at least one node & there's no overflow. | 168 | * Ensure we have space for at least one node & there's no overflow. |
169 | * In order to control memory footprint, we require count < INT_MAX | 169 | * In order to control memory footprint, we require count < INT_MAX |
170 | */ | 170 | */ |
171 | count = length; | 171 | count = length / blk_size; |
172 | if (!base || !count || count > INT_MAX) | 172 | if (!base || !count || count > INT_MAX) |
173 | return -EINVAL; | 173 | return -EINVAL; |
174 | 174 | ||