gpu: nvgpu: Fix CERT-C Violations

Fix the following CERT-C Violations:
gsp_runlist.c : CERT EXP34-C
channel_sync_syncpt.c : CERT ERR33-C
grmgr_ga100.c : CERT ERR33-C
grmgr_ga10b.c : CERT ERR33-C
debug.c : CERT ERR33-C
debug_fecs_trace.c : CERT EXP34-C
ioctl.c : CERT ERR33-C

CID 495110
CID 141061
CID 222881
CID 222890
CID 450994
CID 366644
CID 466529

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I318a27a6fcb8ea8f6d5d6c1f65d940c48d6f8dfc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2723008
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Jinesh Parakh
2022-06-01 12:03:08 +05:30
committed by mobile promotions
parent dcec7f184e
commit b8b90f85ee
7 changed files with 24 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2021, NVIDIA Corporation. All rights reserved.
* Copyright (C) 2017-2022, 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,
@@ -59,9 +59,12 @@ static inline void gk20a_debug_write_to_seqfile(void *ctx, const char *str)
void gk20a_debug_output(struct nvgpu_debug_context *o, const char *fmt, ...)
{
va_list args;
int err;
va_start(args, fmt);
vsnprintf(o->buf, sizeof(o->buf), fmt, args);
err = vsnprintf(o->buf, sizeof(o->buf), fmt, args);
nvgpu_assert(err > 0);
va_end(args);
o->fn(o->ctx, o->buf);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2022, 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,
@@ -61,6 +61,10 @@ static int gk20a_fecs_trace_debugfs_ring_seq_show(
u32 tag;
u64 timestamp;
if (r == NULL) {
return -ENOMEM;
}
seq_printf(s, "record #%lld (%p)\n", *pos, r);
seq_printf(s, "\tmagic_lo=%08x\n", r->magic_lo);
seq_printf(s, "\tmagic_hi=%08x\n", r->magic_hi);

View File

@@ -435,6 +435,7 @@ static int nvgpu_prepare_mig_dev_node_class_list(struct gk20a *g, u32 *num_class
u32 i;
u32 num_instances;
struct nvgpu_cdev_class_priv_data *priv_data;
int err;
num_instances = g->mig.num_gpu_instances;
/*
@@ -446,9 +447,10 @@ static int nvgpu_prepare_mig_dev_node_class_list(struct gk20a *g, u32 *num_class
return -ENOMEM;
}
snprintf(priv_data->class_name, sizeof(priv_data->class_name),
err = snprintf(priv_data->class_name, sizeof(priv_data->class_name),
"nvidia%s-gpu-fgpu%u",
(g->pci_class != 0U) ? "-pci" : "", i);
nvgpu_assert(err > 0);
class = nvgpu_create_class(g, priv_data->class_name);
if (class == NULL) {