mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
gpu: nvgpu: MISRA 21.15 fixes to acr code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs to qualified/unqualified types. To circumvent this issue we've introduced a new MISRA-compliant nvgpu_memcpy() function. This change switches all offending uses of memcpy() in acr code over to use nvgpu_memcpy() with appropriate casts applied. JIRA NVGPU-849 Change-Id: Ib7bac9353cf69c402f8925927c84d4ae7ecbe49d Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1939422 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
68a042c8d4
commit
5c74b5a209
@@ -36,6 +36,7 @@
|
||||
#include <nvgpu/io.h>
|
||||
#include <nvgpu/utils.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/string.h>
|
||||
|
||||
#include "mm_gm20b.h"
|
||||
#include "pmu_gm20b.h"
|
||||
@@ -125,7 +126,7 @@ static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img)
|
||||
err = -ENOMEM;
|
||||
goto release_sig;
|
||||
}
|
||||
memcpy(lsf_desc, (void *)pmu_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)pmu_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), pmu_sig->size));
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_PMU;
|
||||
|
||||
@@ -165,7 +166,7 @@ static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img)
|
||||
err = -ENOMEM;
|
||||
goto rel_sig;
|
||||
}
|
||||
memcpy(lsf_desc, (void *)fecs_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)fecs_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), fecs_sig->size));
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_FECS;
|
||||
|
||||
@@ -237,7 +238,7 @@ static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img)
|
||||
err = -ENOMEM;
|
||||
goto rel_sig;
|
||||
}
|
||||
memcpy(lsf_desc, (void *)gpccs_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)gpccs_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), gpccs_sig->size));
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <nvgpu/utils.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/sec2if/sec2_if_cmn.h>
|
||||
#include <nvgpu/string.h>
|
||||
|
||||
#include "gm20b/mm_gm20b.h"
|
||||
#include "gm20b/acr_gm20b.h"
|
||||
@@ -160,7 +161,7 @@ int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
|
||||
err = -ENOMEM;
|
||||
goto release_sig;
|
||||
}
|
||||
memcpy(lsf_desc, (void *)pmu_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)pmu_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), pmu_sig->size));
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_PMU;
|
||||
|
||||
@@ -233,7 +234,7 @@ int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
|
||||
err = -ENOMEM;
|
||||
goto rel_sig;
|
||||
}
|
||||
memcpy(lsf_desc, (void *)fecs_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)fecs_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), fecs_sig->size));
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_FECS;
|
||||
|
||||
@@ -433,7 +434,7 @@ int sec2_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
|
||||
goto release_sig;
|
||||
}
|
||||
|
||||
memcpy(lsf_desc, (void *)sec2_sig->data,
|
||||
nvgpu_memcpy((u8 *)lsf_desc, (u8 *)sec2_sig->data,
|
||||
min_t(size_t, sizeof(*lsf_desc), sec2_sig->size));
|
||||
|
||||
lsf_desc->falcon_id = LSF_FALCON_ID_SEC2;
|
||||
|
||||
Reference in New Issue
Block a user