mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add checks for sizes of data types
Check sizes of the data types considered as "same types" in the CERT-C EXP37-C deviation record. JIRA NVGPU-3561 Change-Id: I99c0da1adfee6c4809aa1439e67aae57baa2642d Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2282951 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
73df40d9d4
commit
fa75e9d2de
@@ -687,6 +687,27 @@ static inline void nvgpu_safety_checks(void)
|
||||
(NVGPU_PRECISION(ULLONG_MAX) != 64)) {
|
||||
BUG();
|
||||
}
|
||||
|
||||
#if defined(__QNX__)
|
||||
/*
|
||||
* For CERT-C EXP37-C rule
|
||||
* Check sizes of same types considered for EXP37-C deviation record.
|
||||
* If the sizes of data types are same, a compiler results in using same
|
||||
* size and same precision base data type like int, long or long long,
|
||||
* etc for redefined data types.
|
||||
*/
|
||||
if ((sizeof(s64) != sizeof(long) ||
|
||||
sizeof(s64) != sizeof(int64_t) ||
|
||||
sizeof(u64) != sizeof(uint64_t) ||
|
||||
sizeof(u64) != sizeof(_Uint64t) ||
|
||||
sizeof(u64) != sizeof(uintptr_t) ||
|
||||
sizeof(u64) != sizeof(unsigned long) ||
|
||||
sizeof(size_t) != sizeof(u64) ||
|
||||
sizeof(size_t) != sizeof(unsigned long long) ||
|
||||
sizeof(unsigned long long) != sizeof(unsigned long))) {
|
||||
BUG();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user