gpu: nvgpu: fix CERT-C issues

- CID 10165014
  Dereference before null check

- CID 10166579
  Unused value

Bug 3952896

Change-Id: I6a7f2b97b4a6519272607e560d09c138048bd665
Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2872276
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
srajum
2023-03-16 15:07:28 +05:30
committed by mobile promotions
parent f791adf880
commit 02834f8739
2 changed files with 5 additions and 2 deletions

View File

@@ -810,6 +810,10 @@ static int nvgpu_nvs_ctrl_fifo_scheduler_process_receiver(struct gk20a *g,
{
int result = 0;
if ((receiver_queue_sender == NULL) || (send_queue_receiver == NULL)) {
return -1;
}
(void)memset(receiver_queue_sender->internal_buffer, 0,
NVS_DOMAIN_MESSAGE_MAX_PAYLOAD_SIZE);

View File

@@ -1,7 +1,7 @@
/*
* Tegra GK20A GPU Debugger/Profiler Driver
*
* Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -2721,7 +2721,6 @@ static int nvgpu_dbg_gpu_access_gpu_va(struct dbg_session_gk20a *dbg_s,
if (size > allocated_size) {
if (buffer) {
nvgpu_big_free(g, buffer);
buffer = NULL;
}
buffer = nvgpu_big_zalloc(g, size);