mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
kernel: nvidia: fix cert warnings
Using this patch we are fixing below cert warnings :- 1. cert_err33_c_violation: The error status of function call snprintf(name, 20UL, "ivc-queue%d", i) is not checked. 2. cert_err33_c_violation: The error status of function call snprintf(name, 30UL, "gr-virt-comm-%d", i) is not checked. 3. cert_err33_c_violation: The error status of function call snprintf(name, 20UL, "mempool%d", i) is not checked. Below changes has been done to fix above cert warnings:- 1. check the return value to snprintf function and handle return error gracefully. Bug 3512545 Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Change-Id: Ia41ab89e3759387b36489dca5f57652f7389f328 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2676650 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
15ef43911c
commit
4636d2781e
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tegra Graphics Virtualization Communication Framework
|
||||
*
|
||||
* Copyright (c) 2013-2021, NVIDIA Corporation. All rights reserved.
|
||||
* Copyright (c) 2013-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,
|
||||
@@ -219,7 +219,11 @@ static int setup_mempool(struct platform_device *pdev,
|
||||
char name[20];
|
||||
u32 inst;
|
||||
|
||||
snprintf(name, sizeof(name), "mempool%d", i);
|
||||
if (snprintf(name, sizeof(name), "mempool%d", i) < 0) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (of_property_read_u32_index(dev->of_node, name,
|
||||
PROP_MEMPOOL_INST, &inst) == 0) {
|
||||
struct gr_comm_mempool_context *ctx;
|
||||
@@ -268,7 +272,11 @@ static int setup_ivc(struct platform_device *pdev,
|
||||
char name[20];
|
||||
u32 inst;
|
||||
|
||||
snprintf(name, sizeof(name), "ivc-queue%d", i);
|
||||
if (snprintf(name, sizeof(name), "ivc-queue%d", i) < 0) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (of_property_read_u32_index(dev->of_node, name,
|
||||
PROP_IVC_INST, &inst) == 0) {
|
||||
struct device_node *hv_dn;
|
||||
@@ -359,7 +367,11 @@ int tegra_gr_comm_init(struct platform_device *pdev, u32 elems,
|
||||
if (queue->valid)
|
||||
return -EEXIST;
|
||||
|
||||
snprintf(name, sizeof(name), "gr-virt-comm-%d", i);
|
||||
if (snprintf(name, sizeof(name), "gr-virt-comm-%d", i) < 0) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
queue->element_cache =
|
||||
kmem_cache_create(name,
|
||||
sizeof(struct gr_comm_element) + size, 0,
|
||||
|
||||
Reference in New Issue
Block a user