mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
KMD: Fix Misra-C:2012 Rule
- This patch fixes the following violations OVERRUN - 2 (CIDs 22827501, 22827481) - Added checks to validate boundries Rule: OVERRUN Rule Description: Out-of-bounds access to a buffer JIRA TDS-15862 Change-Id: I94b19dc491583a63ec242c59cc288c5e32134cc0 Signed-off-by: saranyad <saranyad@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3299743 Reviewed-by: svcacv <svcacv@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Adithya Sanjeev Byalpi <abyalpi@nvidia.com> Reviewed-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
This commit is contained in:
@@ -76,11 +76,16 @@ out:
|
|||||||
static struct tegra_dce_client_ipc *dce_client_ipc_lookup_handle(u32 handle)
|
static struct tegra_dce_client_ipc *dce_client_ipc_lookup_handle(u32 handle)
|
||||||
{
|
{
|
||||||
struct tegra_dce_client_ipc *cl = NULL;
|
struct tegra_dce_client_ipc *cl = NULL;
|
||||||
|
u32 index = 0U;
|
||||||
|
|
||||||
if (!is_client_handle_valid(handle))
|
if (!is_client_handle_valid(handle))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
cl = &client_handles[client_handle_to_index(handle)];
|
index = client_handle_to_index(handle);
|
||||||
|
if (index >= DCE_CLIENT_IPC_TYPE_MAX)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
cl = &client_handles[index];
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return cl;
|
return cl;
|
||||||
@@ -174,6 +179,7 @@ int tegra_dce_register_ipc_client(u32 type,
|
|||||||
struct tegra_dce *d = NULL;
|
struct tegra_dce *d = NULL;
|
||||||
struct tegra_dce_client_ipc *cl = NULL;
|
struct tegra_dce_client_ipc *cl = NULL;
|
||||||
u32 handle = DCE_CLIENT_IPC_HANDLE_INVALID;
|
u32 handle = DCE_CLIENT_IPC_HANDLE_INVALID;
|
||||||
|
u32 index = 0U;
|
||||||
|
|
||||||
if (handlep == NULL) {
|
if (handlep == NULL) {
|
||||||
dce_os_err(d, "Invalid handle pointer");
|
dce_os_err(d, "Invalid handle pointer");
|
||||||
@@ -199,7 +205,14 @@ int tegra_dce_register_ipc_client(u32 type,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
cl = &client_handles[client_handle_to_index(handle)];
|
index = client_handle_to_index(handle);
|
||||||
|
if (index >= DCE_CLIENT_IPC_TYPE_MAX) {
|
||||||
|
dce_os_err(d, "Invalid client handle index: %u", index);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl = &client_handles[index];
|
||||||
|
|
||||||
cl->d = d;
|
cl->d = d;
|
||||||
cl->type = type;
|
cl->type = type;
|
||||||
|
|||||||
Reference in New Issue
Block a user