mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: mm: make num_user_mapped_buffers a u32
The vm object num_user_mapped_buffers was declared as an int. However, it is an unsigned value. Being a signed value required a cast to unsigned when calling nvgpu_big_zalloc() which causes a CERT-C INT31 violation. So, avoid the cast and use an unsigned type. And fix related INT30 violations related to num_user_mapped_buffers as well. To avoid introducing new MISRA/CERT-C violations, update the upstream user of these changes, fifo/channel.c and make the equivalent uses of this value, num_mapped_buffers a u32 as well. JIRA NVGPU-3517 Change-Id: I6f6d9dfe4a0ee16789b8cd17b908a3f3f9c4a40c Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2127427 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> 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
e1094c4800
commit
f83447d134
@@ -1979,7 +1979,8 @@ int nvgpu_channel_add_job(struct nvgpu_channel *c,
|
||||
{
|
||||
struct vm_gk20a *vm = c->vm;
|
||||
struct nvgpu_mapped_buf **mapped_buffers = NULL;
|
||||
int err = 0, num_mapped_buffers = 0;
|
||||
int err = 0;
|
||||
u32 num_mapped_buffers = 0;
|
||||
bool pre_alloc_enabled = nvgpu_channel_is_prealloc_enabled(c);
|
||||
|
||||
if (!skip_buffer_refcounting) {
|
||||
@@ -2138,7 +2139,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
|
||||
}
|
||||
}
|
||||
|
||||
if (job->num_mapped_buffers != 0) {
|
||||
if (job->num_mapped_buffers != 0U) {
|
||||
nvgpu_vm_put_buffers(vm, job->mapped_buffers,
|
||||
job->num_mapped_buffers);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user