mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 09:57:08 +03:00
gpu: nvgpu: fix certc violations in utils unit
INT31-C Requires that integer conversions do not result in lost or misinterpreted data. Fix violations of INT31-C in utils unit. Jira NVGPU-3609 Change-Id: I6d216fc76b2c84f81a0fc0f67822e6bc632b8397 Signed-off-by: ajesh <akv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2169861 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan <pelcan@nvidia.com> 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:
@@ -214,10 +214,13 @@ static inline unsigned int nvgpu_posix_hweight32(uint32_t x)
|
|||||||
static inline unsigned int nvgpu_posix_hweight64(uint64_t x)
|
static inline unsigned int nvgpu_posix_hweight64(uint64_t x)
|
||||||
{
|
{
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
u32 lo, hi;
|
||||||
|
|
||||||
ret = nvgpu_posix_hweight32((uint32_t)x);
|
lo = nvgpu_safe_cast_u64_to_u32(x & ~(u32)0);
|
||||||
ret += nvgpu_posix_hweight32((uint32_t)((x &
|
hi = nvgpu_safe_cast_u64_to_u32(x >> 32) & ~(u32)0;
|
||||||
0xffffffff00000000U) >> 32));
|
|
||||||
|
ret = nvgpu_posix_hweight32(lo);
|
||||||
|
ret += nvgpu_posix_hweight32(hi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user