gpu: nvgpu: assert the log type

In __nvgpu_really_print_log: Guarantee that log type is valid before
referring to the string from log_types.

CID 393604

Change-Id: I22d5e68647ee36712157d988061191636cba4e4b
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2722480
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2022-05-31 15:37:32 +05:30
committed by mobile promotions
parent e30ddf2771
commit 88a3a3d8d8

View File

@@ -64,7 +64,10 @@ static void __nvgpu_really_print_log(u32 trace, const char *gpu_name,
enum nvgpu_log_type type, const char *log) enum nvgpu_log_type type, const char *log)
{ {
const char *name = gpu_name ? gpu_name : ""; const char *name = gpu_name ? gpu_name : "";
const char *log_type = log_types[type]; const char *log_type;
nvgpu_assert(type >= NVGPU_ERROR && type <= NVGPU_INFO);
log_type = log_types[type];
#ifdef CONFIG_GK20A_TRACE_PRINTK #ifdef CONFIG_GK20A_TRACE_PRINTK
if (trace) if (trace)