NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvos_static_analysis.h
Go to the documentation of this file.
1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2019-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12 
13 #ifndef INCLUDED_NVOS_STATIC_ANALYSIS_H
14 #define INCLUDED_NVOS_STATIC_ANALYSIS_H
15 
22 #include <stdint.h>
23 #include <stddef.h>
24 #include <stdbool.h>
25 #if defined(__QNX__)
26 #include <unistd.h>
27 #ifndef NV_IOSOCK
28 #include <hw/inout.h>
29 #endif
30 #ifdef NV_IOSOCK
31 #define NVOS_EXIT(x) _Exit(x)
32 #else
33 #define NVOS_EXIT(x) _exit(x)
34 #endif
35 #endif /* End of __QNX__ */
36 #if defined(__linux__)
37 #if !defined(NVOS_EXIT)
38 #include <unistd.h>
39 #define NVOS_EXIT(x) _exit(x)
40 #endif
41 #endif
42 
43 #if defined(__cplusplus)
44 extern "C"
45 {
46 #endif
47 
52 #ifdef NV_IS_COVERITY
53 
68 #define NVOS_MISRA(type, num) MISRA_C_2023_##type##_##num
69 
82 #define NVOS_CERT(num) CERT_##num
83 
87 #define NVOS_COV_STRING(x) #x
88 
118 #define NVOS_COV_WHITELIST(type, checker, comment_str) \
119  _Pragma(NVOS_COV_STRING(coverity compliance type checker comment_str))
120 
149 #define NVOS_COV_WHITELIST_BLOCK_BEGIN(type, num, checker, comment_str) \
150 _Pragma(NVOS_COV_STRING(coverity compliance block type:num checker comment_str))
151 
165 #define NVOS_COV_WHITELIST_BLOCK_END(checker) \
166  _Pragma(NVOS_COV_STRING(coverity compliance end_block checker))
167 
188 #define NVOS_COV_PEND_WHITELIST(checker, comment_str) \
189  NVOS_COV_WHITELIST(deviate, checker, comment_str)
190 
191 #else
192 
196 #define NVOS_MISRA(type, num)
197 #define NVOS_CERT(num)
198 #define NVOS_COV_STRING(x)
199 #define NVOS_COV_WHITELIST(type, checker, comment_str)
200 #define NVOS_COV_WHITELIST_BLOCK_BEGIN(type, num, checker, comment_str)
201 #define NVOS_COV_WHITELIST_BLOCK_END(checker)
202 #define NVOS_COV_PEND_WHITELIST(checker, comment_str)
203 #endif
204 
210 #define ERR_INT30_C_ADDU16 0x378
211 #define ERR_INT30_C_ADDU32 0x377
212 #define ERR_INT30_C_ADDU64 0x376
213 #define ERR_INT30_C_SUBU32 0x375
214 #define ERR_INT30_C_SUBU64 0x374
215 #define ERR_INT30_C_MULTU32 0x373
216 #define ERR_INT30_C_MULTU64 0x372
217 #define ERR_INT32_C_ADDS32 0x371
218 #define ERR_INT32_C_ADDS64 0x370
219 #define ERR_INT32_C_SUBS32 0x369
220 #define ERR_INT32_C_SUBS64 0x368
221 #define ERR_INT32_C_MULTS32 0x367
222 #define ERR_INT32_C_MULTS64 0x366
223 #define ERR_INT32_C_DIVS32 0x365
224 #define ERR_INT32_C_DIVS64 0x364
225 #define ERR_INT31_C_CAST_U64TOU8 0x361
226 #define ERR_INT31_C_CAST_U32TOS32 0x360
227 #define ERR_INT31_C_CAST_U32TOU16 0x359
228 #define ERR_INT31_C_CAST_U32TOU8 0x358
229 #define ERR_INT31_C_CAST_U64TOU32 0x357
230 #define ERR_INT31_C_CAST_U64TOS32 0x356
231 #define ERR_INT31_C_CAST_S32TOU32 0x355
232 #define ERR_INT31_C_CAST_S64TOU32 0x354
233 #define ERR_INT31_C_CAST_S32TOU64 0x353
234 #define ERR_INT31_C_CAST_S32TOU8 0x352
235 #define ERR_INT31_C_CAST_S64TOU64 0x351
236 #define ERR_INT31_C_CAST_S64TOS32 0x350
237 #define ERR_INT31_C_CAST_U64TOS64 0x34F
238 #define ERR_INT30_C_ADDU64UPTR 0x34E
239 #define ERR_INT30_C_ADDU32UPTR 0x34D
240 #define ERR_INT30_C_ADDU32VPTR ERR_INT30_C_ADDU32UPTR
241 #define ERR_INT30_C_MULTSIZET 0x34C
242 
246 #define VA_ADDR_MASK 0xFFFFFFFFFFFFUL
247 #define OFFSET_MASK 0xFFFFUL
248 
249 typedef uint32_t NvBoolVar;
253 #ifndef NvBoolTrue
254 #define NvBoolTrue ((NvBoolVar)0xBABAFACEU)
255 #endif
256 
260 #ifndef NvBoolFalse
261 #define NvBoolFalse ((NvBoolVar)0x45450531U)
262 #endif
263 
267 #define NV_UINTPTR_MAX ((uintptr_t)0U - 1U)
268 
271  int32_t flag_int32;
272  uint32_t flag_uint32;
273 };
274 
275 /*
276  * Utility function to check for CERT-C violation.
277  */
278 
282 static inline bool AddU16(uint16_t op1, uint16_t op2, uint16_t *result)
283 {
284  bool e = false;
285 
286  if ((((uint16_t)UINT16_MAX - op1) < op2) == false) {
287  *result = (uint16_t)(op1 + op2);
288  e = true;
289  }
290 
291  return e;
292 }
293 
294 #if defined(INT16_MAX)
295 
298 static inline bool AddS16(int16_t op1, int16_t op2, int16_t *result)
299 {
300  bool e = false;
301 
302  if (((op2 > 0) && (op1 > (INT16_MAX - op2))) ||
303  ((op2 < 0) && (op1 < (INT16_MIN - op2)))) {
304  return e;
305  } else {
306  *result = op1 + op2;
307  e = true;
308  }
309  return e;
310 }
311 #endif
312 
316 static inline bool AddU32(uint32_t op1, uint32_t op2, uint32_t *result)
317 {
318  bool e = false;
319 
320  if (((UINT32_MAX - op1) < op2) == false) {
321  *result = op1 + op2;
322  e = true;
323  }
324 
325  return e;
326 }
327 
331 static inline bool AddS32(int32_t op1, int32_t op2, int32_t *result)
332 {
333  bool e = false;
334 
335  if (((op2 > 0) && (op1 > (INT32_MAX - op2))) ||
336  ((op2 < 0) && (op1 < (INT32_MIN - op2)))) {
337  return e;
338  } else {
339  *result = op1 + op2;
340  e = true;
341  }
342  return e;
343 }
344 
348 static inline bool AddU64(uint64_t op1, uint64_t op2, uint64_t *result)
349 {
350  bool e = false;
351 
352  if (((UINT64_MAX - op1) < op2) == false) {
353  *result = op1 + op2;
354  e = true;
355  }
356  return e;
357 }
358 
362 static inline bool AddS64(int64_t op1, int64_t op2, int64_t *result)
363 {
364  bool e = false;
365 
366  if (((op2 > 0) && (op1 > (INT64_MAX - op2))) ||
367  ((op2 < 0) && (op1 < (INT64_MIN - op2)))) {
368  return e;
369  } else {
370  *result = op1 + op2;
371  e = true;
372  }
373  return e;
374 }
375 
380 static inline bool MultU32(uint32_t op1, uint32_t op2, uint32_t *result)
381 {
382  bool e = false;
383 
384  if ((op1 == 0U) || (op2 == 0U)) {
385  *result = 0U;
386  } else if ((op1 > (UINT32_MAX / op2)) == false) {
387  *result = op1 * op2;
388  } else {
389  goto fail;
390  }
391 
392  e = true;
393 
394 fail:
395  return e;
396 }
397 
402 static inline bool MultU16(uint16_t op1, uint16_t op2, uint16_t *result)
403 {
404  bool e = false;
405 
406  if ((op1 == 0U) || (op2 == 0U)) {
407  *result = 0U;
408  } else {
409  uint32_t prod = (uint32_t)op1 * (uint32_t)op2;
410 
411  if (prod > (uint32_t)UINT16_MAX) {
412  goto fail;
413  }
414  *result = (uint16_t)prod;
415  }
416 
417  e = true;
418 
419 fail:
420  return e;
421 }
422 
427 static inline bool CastU64toU32(uint64_t op1, uint32_t *result)
428 {
429  bool e = false;
430 
431  if (op1 <= (uint64_t)UINT32_MAX) {
432  *result = (uint32_t)op1;
433  e = true;
434  }
435 
436  return e;
437 }
438 
439 
443 static inline void incrementUInt32(uint32_t *x)
444 {
445  if (*x < UINT32_MAX) {
446  (*x)++;
447  } else {
448  *x = UINT32_MAX;
449  }
450 }
451 
452 
456 static inline void incrementUInt64(uint64_t *x)
457 {
458  if (*x < UINT64_MAX) {
459  (*x)++;
460  } else {
461  *x = UINT64_MAX;
462  }
463 }
464 
469 static inline bool CastU64toS32(uint64_t op1, int32_t *result)
470 {
471  bool e = false;
472 
473  if (op1 <= (uint64_t)INT32_MAX) {
474  *result = (int32_t)op1;
475  e = true;
476  }
477 
478  return e;
479 }
480 
485 static inline bool CastU32toS32(uint32_t op1, int32_t *result)
486 {
487  bool e = false;
488 
489  if (op1 <= (uint32_t)INT32_MAX) {
490  *result = (int32_t)op1;
491  e = true;
492  }
493 
494  return e;
495 }
496 
501 static inline bool CastS32toU32(int32_t op1, uint32_t *result)
502 {
503  bool e = false;
504 
505  if (op1 >= 0) {
506  *result = (uint32_t)op1;
507  e = true;
508  }
509 
510  return e;
511 }
512 
517 static inline bool CastS32toU16(int32_t op1, uint16_t *result)
518 {
519  bool e = false;
520 
521  if ((op1 >= 0) && (op1 <= (int32_t)UINT16_MAX)) {
522  *result = (uint16_t)op1;
523  e = true;
524  }
525 
526  return e;
527 }
528 
533 static inline bool MultU64(uint64_t op1, uint64_t op2, uint64_t *result)
534 {
535  bool e = false;
536 
537  if ((op1 == 0U) || (op2 == 0U)) {
538  *result = 0U;
539  } else if ((op1 > (UINT64_MAX / op2)) == false) {
540  *result = op1 * op2;
541  } else {
542  goto fail;
543  }
544 
545  e = true;
546 
547 fail:
548  return e;
549 }
550 
562 static inline bool MultS32(int32_t op1, int32_t op2, int32_t *result)
563 {
564  bool e = false;
565 
566  if ((op1 == 0) || (op2 == 0)) {
567  *result = 0;
568  } else if (op1 > (INT32_MAX / op2)) {
569  goto fail;
570  } else {
571  *result = op1 * op2;
572  }
573 
574  e = true;
575 
576 fail:
577  return e;
578 }
579 
580 
585 static inline bool MultS64(int64_t op1, int64_t op2, int64_t *result)
586 {
587  bool e = false;
588 
589  if (op1 > 0) { /* op1 is positive */
590  if (op2 > 0) { /* op1 and op2 are positive */
591  if (op1 > (INT64_MAX / op2)) {
592  return e;
593  }
594  } else { /* op1 positive, op2 nonpositive */
595  if (op2 < (INT64_MIN / op1)) {
596  return e;
597  }
598  } /* op1 positive, op2 nonpositive */
599  } else { /* op1 is nonpositive */
600  if (op2 > 0) { /* op1 is nonpositive, op2 is positive */
601  if (op1 < (INT64_MIN / op2)) {
602  return e;
603  }
604  } else { /* op1 and op2 are nonpositive */
605  if ( (op1 != 0) && (op2 < (INT64_MAX / op1))) {
606  return e;
607  }
608  } /* End if op1 and op2 are nonpositive */
609  } /* End if op1 is nonpositive */
610 
611  e = true;
612  *result = op1 * op2;
613  return e;
614 }
615 
620 static inline bool SubU32(uint32_t op1, uint32_t op2, uint32_t *result)
621 {
622  bool e = false;
623 
624  if ((op1 < op2) == false) {
625  *result = op1 - op2;
626  e = true;
627  }
628 
629  return e;
630 }
631 
636 static inline bool SubU16(uint16_t op1, uint16_t op2, uint16_t *result)
637 {
638  bool e = false;
639 
640  if ((op1 < op2) == false) {
641  *result = (uint16_t)(op1 - op2);
642  e = true;
643  }
644 
645  return e;
646 }
647 
653 static inline bool SubS32(int32_t op1, int32_t op2, int32_t *result)
654 {
655  bool e;
656 
657  if (((op2 > 0) && (op1 < (INT32_MIN + op2))) ||
658  ((op2 < 0) && (op1 > (INT32_MAX + op2)))) {
659  e = false;
660  } else {
661  *result = op1 - op2;
662  e = true;
663  }
664 
665  return e;
666 }
667 
672 static inline bool SubU64(uint64_t op1, uint64_t op2, uint64_t *result)
673 {
674  bool e = false;
675 
676  if ((op1 < op2) == false) {
677  *result = op1 - op2;
678  e = true;
679  }
680 
681  return e;
682 }
683 
688 static inline bool SubS64(int64_t op1, int64_t op2, int64_t *result)
689 {
690  bool e = false;
691 
692  if (((op2 > 0) && (op1 < (INT64_MIN + op2))) ||
693  ((op2 < 0) && (op1 > (INT64_MAX + op2)))) {
694  return e;
695  } else {
696  *result = op1 - op2;
697  e = true;
698  }
699  return e;
700 }
701 
707 static inline
708 bool SubSizet(size_t op1, size_t op2, size_t *result)
709 {
710  if ((op1 < op2) == false) {
711  *result = op1 - op2;
712  return true;
713  } else {
714  return false;
715  }
716 }
717 
722 #ifdef NVOS_EXIT
723 
730 static inline
731 void AddU16WithExit(uint16_t op1, uint16_t op2, uint16_t *result)
732 {
733  if ((((uint16_t)UINT16_MAX - op1) < op2) == false) {
734  *result = (uint16_t)(op1 + op2);
735  } else {
737  }
738 }
739 
746 static inline
747 void AddU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
748 {
749  if (((UINT32_MAX - op1) < op2) == false) {
750  *result = op1 + op2;
751  } else {
753  }
754 }
755 
762 static inline
763 void AddU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
764 {
765  if (((UINT64_MAX - op1) < op2) == false) {
766  *result = op1 + op2;
767  } else {
769  }
770 }
771 
779 static inline
780 void AddU32UPTRWithExit(uintptr_t op1, uint32_t op2, uintptr_t *result)
781 {
782  if (((NV_UINTPTR_MAX - op1) < op2) == false) {
783  *result = op1 + op2;
784  } else {
786  }
787 }
788 
796 static inline
798  const void *op1,
799  uint32_t op2, const void **result)
800 {
801  NVOS_COV_WHITELIST(deviate, NVOS_MISRA(Rule, 11_6), "<QNXBSP>:<nvidia>:<1>:<TID-371>")
802  if (op1 > (const void *)((uintptr_t)NV_UINTPTR_MAX - (uintptr_t)op2)) {
804  } else {
805  *result = (const void *)((const uint8_t *)op1 + op2);
806  }
807 }
808 
816 static inline
817 void AddUPTRSizetWithExit(uintptr_t op1, size_t op2, uintptr_t *result)
818 {
819  if (((NV_UINTPTR_MAX - op1) < op2) == false) {
820  *result = op1 + op2;
821  } else {
823  }
824 }
825 
833 static inline
834 void AddSizetWithExit(size_t op1, size_t op2, size_t *result)
835 {
836  if (((SIZE_MAX - op1) < op2) == false) {
837  *result = op1 + op2;
838  } else {
840  }
841 }
842 
850 static inline
851 void MultSizetWithExit(size_t op1, size_t op2, size_t *result)
852 {
853  if ((op1 == (size_t)0) || (op2 == (size_t)0)) {
854  *result = (size_t)0;
855  } else if (op1 > (SIZE_MAX / op2)) {
857  } else {
858  *result = op1 * op2;
859  }
860 }
861 
869 static inline
870 void AddU64UPTRWithExit(uintptr_t op1, uint64_t op2, uintptr_t *result)
871 {
872  if (((NV_UINTPTR_MAX - op1) < op2) == false) {
873  *result = op1 + op2;
874  } else {
876  }
877 }
885 static inline
886 void MultU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
887 {
888  if ((op1 == 0U) || (op2 == 0U)) {
889  *result = 0U;
890  } else if ((op1 > (UINT32_MAX / op2)) == true) {
892  } else {
893  *result = op1 * op2;
894  }
895 }
896 
904 static inline
905 void MultU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
906 {
907  if ((op1 == 0UL) || (op2 == 0UL)) {
908  *result = 0UL;
909  } else if ((op1 > (UINT64_MAX / op2)) == true) {
911  } else {
912  *result = op1 * op2;
913  }
914 }
915 
923 static inline
924 void SubU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
925 {
926  if ((op1 < op2) == false) {
927  *result = op1 - op2;
928  } else {
930  }
931 }
932 
940 static inline
941 void SubU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
942 {
943  if ((op1 < op2) == false) {
944  *result = op1 - op2;
945  } else {
947  }
948 }
949 
957 static inline
958 void SubSizetWithExit(size_t op1, size_t op2, size_t *result)
959 {
960  if ((op1 < op2) == false) {
961  *result = op1 - op2;
962  } else {
964  }
965 }
966 
973 static inline
974 void AddS32WithExit(int32_t op1, int32_t op2, int32_t *result)
975 {
976  if (((op2 > 0) && (op1 > (INT32_MAX - op2))) ||
977  ((op2 < 0) && (op1 < (INT32_MIN - op2)))) {
979  } else {
980  *result = op1 + op2;
981  }
982 }
983 
984 static inline
985 void AddS64WithExit(int64_t op1, int64_t op2, int64_t *result)
986 {
987  if (((op2 > 0) && (op1 > (INT64_MAX - op2))) ||
988  ((op2 < 0) && (op1 < (INT64_MIN - op2)))) {
990  } else {
991  *result = op1 + op2;
992  }
993 }
994 
995 
1003 static inline
1004 void SubS32WithExit(int32_t op1, int32_t op2, int32_t *result)
1005 {
1006  if (((op2 > 0) && (op1 < (INT32_MIN + op2))) ||
1007  ((op2 < 0) && (op1 > (INT32_MAX + op2)))) {
1009  } else {
1010  *result = op1 - op2;
1011  }
1012 }
1013 
1014 static inline
1015 void SubS64WithExit(int64_t op1, int64_t op2, int64_t *result)
1016 {
1017  if (((op2 > 0) && (op1 < (INT64_MIN + op2))) ||
1018  ((op2 < 0) && (op1 > (INT64_MAX + op2)))) {
1020  } else {
1021  *result = op1 - op2;
1022  }
1023 }
1024 
1025 
1033 static inline
1034 void DivS32WithExit(int32_t op1, int32_t op2, int32_t *result)
1035 {
1036  if ((op2 == 0) || ((op1 == INT32_MIN) && (op2 == -1))) {
1038  } else {
1039  *result = op1 / op2;
1040  }
1041 }
1042 
1043 static inline
1044 void DivS64WithExit(int64_t op1, int64_t op2, int64_t *result)
1045 {
1046  if ((op2 == 0) || ((op1 == INT64_MIN) && (op2 == -1))) {
1048  } else {
1049  *result = op1 / op2;
1050  }
1051 }
1052 
1053 
1057 static inline
1058 uint32_t CastS32toU32WithExit(int32_t op)
1059 {
1060  if (op < 0) {
1062  }
1063  return (uint32_t)op;
1064 }
1065 
1066 static inline
1067 int32_t CastU32toS32WithExit(uint32_t op)
1068 {
1069  if (op > (uint32_t)INT32_MAX) {
1071  }
1072  return (int32_t)op;
1073 }
1074 
1075 static inline
1076 uint16_t CastU32toU16WithExit(uint32_t op)
1077 {
1078  if (op > (uint32_t)UINT16_MAX) {
1080  }
1081  return (uint16_t)op;
1082 }
1083 
1084 static inline
1085 uint8_t CastU32toU8WithExit(uint32_t op)
1086 {
1087  if (op > (uint32_t)UINT8_MAX) {
1089  }
1090  return (uint8_t)op;
1091 }
1092 
1093 static inline
1094 char CastU32toCharWithExit(uint32_t op)
1095 {
1096  if (op > (uint32_t)INT8_MAX) {
1098  }
1099  return (char)op;
1100 }
1101 
1102 static inline
1103 uint8_t CastU64toU8WithExit(uint64_t op)
1104 {
1105  if (op > (uint64_t)UINT8_MAX) {
1107  }
1108  return (uint8_t)op;
1109 }
1110 
1111 static inline
1112 uint32_t CastU64toU32WithExit(uint64_t op)
1113 {
1114  if (op > UINT32_MAX) {
1116  }
1117  return (uint32_t)op;
1118 }
1119 
1120 static inline
1121 int32_t CastU64toS32WithExit(uint64_t op)
1122 {
1123  if (op > (uint64_t)INT32_MAX) {
1125  }
1126  return (int32_t)op;
1127 }
1128 
1129 static inline
1130 uint32_t CastS64toU32WithExit(int64_t op)
1131 {
1132  if ((op > (int64_t)UINT32_MAX) || (op < 0)) {
1134  }
1135  return (uint32_t)op;
1136 }
1137 
1138 static inline
1139 uint64_t CastS32toU64WithExit(int32_t op)
1140 {
1141  if (op < 0) {
1143  }
1144  return (uint64_t)op;
1145 }
1146 
1147 static inline
1148 uint8_t CastS32toU8WithExit(int32_t op)
1149 {
1150  if ((op > (int32_t)UINT8_MAX) || (op < 0)) {
1152  }
1153  return (uint8_t)op;
1154 }
1155 
1156 static inline
1157 uint64_t CastS64toU64WithExit(int64_t op)
1158 {
1159  if (op < 0) {
1161  }
1162  return (uint64_t)op;
1163 }
1164 
1165 static inline
1166 int32_t CastS64toS32WithExit(int64_t op)
1167 {
1168  int32_t max = INT32_MAX;
1169  int32_t min = INT32_MIN;
1170 
1171  if ((op > (int64_t)max) || (op < (int64_t)min)) {
1173  }
1174  return (int32_t)op;
1175 }
1176 
1177 static inline
1178 int64_t CastU64toS64WithExit(uint64_t op)
1179 {
1180  if (op > (uint64_t)INT64_MAX) {
1182  }
1183  return (int64_t)op;
1184 }
1185 #endif /* End of NVOS_EXIT */
1186 
1192 static inline
1193 bool AddU32UPTR(uintptr_t op1, uint32_t op2, uintptr_t *result)
1194 {
1195  if (((NV_UINTPTR_MAX - op1) < op2) == false) {
1196  *result = op1 + op2;
1197  return true;
1198  }
1199  return false;
1200 }
1201 
1207 static inline
1208 bool AddU32OffsetToVoidPtr(const void *op1, uint32_t op2, const void **result)
1209 {
1210  NVOS_COV_WHITELIST(deviate, NVOS_MISRA(Rule, 11_6), "<QNXBSP>:<nvidia>:<1>:<TID-371>")
1211  if (op1 <= (const void *)((uintptr_t)NV_UINTPTR_MAX - (uintptr_t)op2)) {
1212  *result = (const void *)((const uint8_t *)op1 + op2);
1213  return true;
1214  }
1215  return false;
1216 }
1217 
1221 static inline
1222 bool NvConvertUint64toUint32(uint64_t op, uint32_t *result)
1223 {
1224  bool e = false;
1225 
1226  if ((op > UINT32_MAX) == false) {
1227  *result = (uint32_t)op;
1228  e = true;
1229  }
1230 
1231  return e;
1232 }
1233 
1237 static inline
1238 bool NvConvertUint64toInt64(uint64_t op, int64_t *result)
1239 {
1240  bool e = false;
1241 
1242  if ((op > (uint64_t)INT64_MAX) == false) {
1243  *result = (int64_t)op;
1244  e = true;
1245  }
1246 
1247  return e;
1248 }
1249 
1253 static inline void NvConvertUint32toInt64(uint32_t op, int64_t *result)
1254 {
1255 
1256  *result = (int64_t)op;
1257 }
1258 
1262 static inline
1263 bool NvConvertUint32toUint16(uint32_t op, uint16_t *result)
1264 {
1265  bool e = false;
1266 
1267  if ((op > (uint32_t)UINT16_MAX) == false) {
1268  *result = (uint16_t)op;
1269  e = true;
1270  }
1271 
1272  return e;
1273 }
1274 
1278 static inline
1279 bool NvConvertUint32toInt32(uint32_t op, int32_t *result)
1280 {
1281  bool e = false;
1282 
1283  if ((op > (uint32_t)INT32_MAX) == false) {
1284  *result = (int32_t)op;
1285  e = true;
1286  }
1287 
1288  return e;
1289 }
1290 
1294 static inline
1295 bool NvConvertUint32toUint8(uint32_t op, uint8_t *result)
1296 {
1297  bool e = false;
1298 
1299  if ((op > (uint32_t )UINT8_MAX) == false) {
1300  *result = (uint8_t)op;
1301  e = true;
1302  }
1303 
1304  return e;
1305 }
1306 
1310 static inline
1311 bool NvConvertLint64toULint64(int64_t op, uint64_t *result)
1312 {
1313  bool e = false;
1314 
1315  if (op >= 0) {
1316  *result = (uint64_t)op;
1317  e = true;
1318  }
1319 
1320  return e;
1321 }
1322 
1326 static inline
1327 bool NvConvertLint64toUint32(int64_t op, uint32_t *result)
1328 {
1329  bool e = false;
1330 
1331  if ((op >= 0) && ((op > (int64_t)UINT32_MAX) == false)) {
1332  *result = (uint32_t)op;
1333  e = true;
1334  }
1335 
1336  return e;
1337 }
1338 
1342 static inline
1343 bool NvConvertLint64toInt32(int64_t op, int32_t *result)
1344 {
1345  bool e = false;
1346  int32_t max = INT32_MAX;
1347  int32_t min = INT32_MIN;
1348 
1349  if ((op >= (int64_t)min) && (op <= (int64_t)max)) {
1350  *result = (int32_t)op;
1351  e = true;
1352  }
1353 
1354  return e;
1355 }
1356 
1360 static inline
1361 bool NvConvertInt32toUint32(int32_t op, uint32_t *result)
1362 {
1363  bool e = false;
1364 
1365  if ((op < 0) == false) {
1366  *result = (uint32_t)op;
1367  e = true;
1368  }
1369 
1370  return e;
1371 }
1372 
1373 #if defined(INT16_MAX)
1374 
1377 static inline
1378 bool NvConvertInt32toInt16(int32_t op, int16_t *result)
1379 {
1380  bool e = false;
1381 
1382  if ((op > INT16_MAX) == false) {
1383  *result = (int16_t)op;
1384  e = true;
1385  }
1386 
1387  return e;
1388 }
1389 
1393 static inline
1394 bool NvConvertUint16toInt16(uint16_t op, int16_t *result)
1395 {
1396  bool e = false;
1397 
1398  if ((op > (uint16_t)INT16_MAX) == false) {
1399  *result = (int16_t)op;
1400  e = true;
1401  }
1402 
1403  return e;
1404 }
1405 #endif /* End of INT16_MAX */
1406 
1411 #if defined(__QNX__)
1412 #ifndef NV_IOSOCK
1413 static inline
1414 void NvWritel(uintptr_t base, uint64_t offset, uint32_t val)
1415 {
1416  out32((base & VA_ADDR_MASK) + (offset & OFFSET_MASK), val);
1417 }
1418 
1419 static inline
1420 uint32_t NvReadl(uintptr_t base, uint64_t offset)
1421 {
1422  return in32((base & VA_ADDR_MASK) + (offset & OFFSET_MASK));
1423 }
1424 #endif
1425 #endif /* End of __QNX__ */
1426 
1433 static inline int32_t NvConvertFlagUInt32toInt32(uint32_t flag_uint32)
1434 {
1435 
1436  union flag_converter flag;
1437 
1438  flag.flag_uint32 = flag_uint32;
1439 
1440  return flag.flag_int32;
1441 }
1442 
1449 static inline uint32_t NvConvertFlagInt32toUInt32(int32_t flag_int32)
1450 {
1451  union flag_converter flag;
1452 
1453  flag.flag_int32 = flag_int32;
1454 
1455  return flag.flag_uint32;
1456 }
1457 
1458 NVOS_COV_WHITELIST(deviate, NVOS_MISRA(Rule, 3_1), "<QNXBSP>:<nvidia>:<1>:<TID-320>")
1466 static inline bool ShiftLeftU32(
1467  uint32_t operand,
1468  uint32_t shift,
1469  uint32_t *result)
1470 {
1471  bool e = false;
1472 
1473  if (shift < 32U /* bits in a uint32_t */) {
1474  *result = (operand << shift);
1475  e = true;
1476  }
1477 
1478  return e;
1479 }
1480 
1481 NVOS_COV_WHITELIST(deviate, NVOS_MISRA(Rule, 3_1), "<QNXBSP>:<nvidia>:<1>:<TID-320>")
1489 static inline bool ShiftRightU32(
1490  uint32_t operand,
1491  uint32_t shift,
1492  uint32_t *result)
1493 {
1494  bool e = false;
1495 
1496  if (shift < 32U /* bits in a uint32_t */) {
1497  *result = (operand >> shift);
1498  e = true;
1499  }
1500 
1501  return e;
1502 }
1503 
1504 #if defined(__cplusplus)
1505 }
1506 #endif
1507 #endif // INCLUDED_NVOS_STATIC_ANALYSIS_H
NvConvertFlagUInt32toInt32
static int32_t NvConvertFlagUInt32toInt32(uint32_t flag_uint32)
CERT INT30-C: Readl and writel APIs to avoid CERT-C warnings.
Definition: nvos_static_analysis.h:1433
SubU64
static bool SubU64(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:672
MultU16
static bool MultU16(uint16_t op1, uint16_t op2, uint16_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:402
CastS32toU32WithExit
static uint32_t CastS32toU32WithExit(int32_t op)
Casting functions to fix CERT INT31-C: Ensure integer conversions do not result in lost or misinterpr...
Definition: nvos_static_analysis.h:1058
ERR_INT30_C_ADDU64
#define ERR_INT30_C_ADDU64
Definition: nvos_static_analysis.h:212
ERR_INT30_C_MULTSIZET
#define ERR_INT30_C_MULTSIZET
Definition: nvos_static_analysis.h:241
ShiftLeftU32
static bool ShiftLeftU32(uint32_t operand, uint32_t shift, uint32_t *result)
CERT INT34-C:
Definition: nvos_static_analysis.h:1466
incrementUInt32
static void incrementUInt32(uint32_t *x)
Increment uint32_t by one Precondition test to ensure value is within RANGE_MAX.
Definition: nvos_static_analysis.h:443
SubS32WithExit
static void SubS32WithExit(int32_t op1, int32_t op2, int32_t *result)
CERT INT32-C: Precondition test to ensure that signed integer subtraction operation does not overflow...
Definition: nvos_static_analysis.h:1004
ERR_INT30_C_MULTU32
#define ERR_INT30_C_MULTU32
Definition: nvos_static_analysis.h:215
AddU32
static bool AddU32(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer add operation do not wrap.
Definition: nvos_static_analysis.h:316
ERR_INT31_C_CAST_U64TOS64
#define ERR_INT31_C_CAST_U64TOS64
Definition: nvos_static_analysis.h:237
ERR_INT31_C_CAST_S32TOU64
#define ERR_INT31_C_CAST_S32TOU64
Definition: nvos_static_analysis.h:233
AddU64WithExit
static void AddU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer add operation do not wrap.
Definition: nvos_static_analysis.h:763
MultSizetWithExit
static void MultSizetWithExit(size_t op1, size_t op2, size_t *result)
CERT INT30-C: Precondition test to ensure that size_t multiplication operation do not wrap.
Definition: nvos_static_analysis.h:851
AddSizetWithExit
static void AddSizetWithExit(size_t op1, size_t op2, size_t *result)
CERT INT30-C: Precondition test to ensure that size_t add operation do not wrap.
Definition: nvos_static_analysis.h:834
flag_converter
convert signedness of 32bit value
Definition: nvos_static_analysis.h:270
NV_UINTPTR_MAX
#define NV_UINTPTR_MAX
Define macro to replace uintptr_t max.
Definition: nvos_static_analysis.h:267
OFFSET_MASK
#define OFFSET_MASK
Definition: nvos_static_analysis.h:247
MultS32
static bool MultS32(int32_t op1, int32_t op2, int32_t *result)
Precondition test to ensure that signed integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:562
CastU64toS32WithExit
static int32_t CastU64toS32WithExit(uint64_t op)
Definition: nvos_static_analysis.h:1121
ERR_INT30_C_ADDU64UPTR
#define ERR_INT30_C_ADDU64UPTR
Definition: nvos_static_analysis.h:238
NVOS_MISRA
#define NVOS_MISRA(type, num)
These macros are used for whitelisting coverity violations.
Definition: nvos_static_analysis.h:196
AddS64WithExit
static void AddS64WithExit(int64_t op1, int64_t op2, int64_t *result)
Definition: nvos_static_analysis.h:985
SubU64WithExit
static void SubU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:941
ERR_INT31_C_CAST_S64TOU64
#define ERR_INT31_C_CAST_S64TOU64
Definition: nvos_static_analysis.h:235
AddS32WithExit
static void AddS32WithExit(int32_t op1, int32_t op2, int32_t *result)
CERT INT32-C: Precondition test to ensure that signed integer add operation do not overflow.
Definition: nvos_static_analysis.h:974
AddU32UPTR
static bool AddU32UPTR(uintptr_t op1, uint32_t op2, uintptr_t *result)
CERT INT30-C: Ensure that uintptr_t and unsigned integer add do not result in lost or misinterpreted ...
Definition: nvos_static_analysis.h:1193
ShiftRightU32
static bool ShiftRightU32(uint32_t operand, uint32_t shift, uint32_t *result)
CERT INT34-C:
Definition: nvos_static_analysis.h:1489
ERR_INT30_C_ADDU16
#define ERR_INT30_C_ADDU16
Exit codes for function that call NVOS_EXIT().
Definition: nvos_static_analysis.h:210
AddS32
static bool AddS32(int32_t op1, int32_t op2, int32_t *result)
CERT INT30-C Precondition test to ensure that integer add operation do not wrap.
Definition: nvos_static_analysis.h:331
CastS64toU64WithExit
static uint64_t CastS64toU64WithExit(int64_t op)
Definition: nvos_static_analysis.h:1157
MultU64
static bool MultU64(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:533
ERR_INT30_C_MULTU64
#define ERR_INT30_C_MULTU64
Definition: nvos_static_analysis.h:216
NvConvertUint32toUint8
static bool NvConvertUint32toUint8(uint32_t op, uint8_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1295
AddU32WithExit
static void AddU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer add operation do not wrap.
Definition: nvos_static_analysis.h:747
SubS64
static bool SubS64(int64_t op1, int64_t op2, int64_t *result)
CERT INT30-C Precondition test to ensure that signed integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:688
ERR_INT32_C_ADDS64
#define ERR_INT32_C_ADDS64
Definition: nvos_static_analysis.h:218
AddU64UPTRWithExit
static void AddU64UPTRWithExit(uintptr_t op1, uint64_t op2, uintptr_t *result)
CERT INT30-C: Precondition test to ensure that uintptr_t unsigned integer add operation do not wrap F...
Definition: nvos_static_analysis.h:870
SubS64WithExit
static void SubS64WithExit(int64_t op1, int64_t op2, int64_t *result)
Definition: nvos_static_analysis.h:1015
NVOS_EXIT
#define NVOS_EXIT(x)
Definition: nvos_static_analysis.h:39
NvConvertLint64toULint64
static bool NvConvertLint64toULint64(int64_t op, uint64_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1311
ERR_INT32_C_DIVS32
#define ERR_INT32_C_DIVS32
Definition: nvos_static_analysis.h:223
NvConvertInt32toUint32
static bool NvConvertInt32toUint32(int32_t op, uint32_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1361
NvConvertFlagInt32toUInt32
static uint32_t NvConvertFlagInt32toUInt32(int32_t flag_int32)
CERT INT31-C:
Definition: nvos_static_analysis.h:1449
AddU32OffsetToVoidPtrWithExit
static void AddU32OffsetToVoidPtrWithExit(const void *op1, uint32_t op2, const void **result)
CERT INT30-C: Precondition test to ensure that void * and unsigned integer add operation does not wra...
Definition: nvos_static_analysis.h:797
NvConvertLint64toUint32
static bool NvConvertLint64toUint32(int64_t op, uint32_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1327
SubU32
static bool SubU32(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:620
AddU32OffsetToVoidPtr
static bool AddU32OffsetToVoidPtr(const void *op1, uint32_t op2, const void **result)
CERT INT30-C: Ensure that adding a 32-bit integer offset to a void pointer does not result in integer...
Definition: nvos_static_analysis.h:1208
NvConvertUint32toInt32
static bool NvConvertUint32toInt32(uint32_t op, int32_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1279
NvBoolVar
uint32_t NvBoolVar
Definition: nvos_static_analysis.h:249
CastS64toU32WithExit
static uint32_t CastS64toU32WithExit(int64_t op)
Definition: nvos_static_analysis.h:1130
MultU64WithExit
static void MultU64WithExit(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:905
ERR_INT32_C_SUBS64
#define ERR_INT32_C_SUBS64
Definition: nvos_static_analysis.h:220
DivS32WithExit
static void DivS32WithExit(int32_t op1, int32_t op2, int32_t *result)
CERT INT32-C: Precondition test to ensure that signed integer division operation does not overflow or...
Definition: nvos_static_analysis.h:1034
ERR_INT31_C_CAST_U32TOU8
#define ERR_INT31_C_CAST_U32TOU8
Definition: nvos_static_analysis.h:228
CastU32toU16WithExit
static uint16_t CastU32toU16WithExit(uint32_t op)
Definition: nvos_static_analysis.h:1076
ERR_INT30_C_SUBU64
#define ERR_INT30_C_SUBU64
Definition: nvos_static_analysis.h:214
flag_converter::flag_uint32
uint32_t flag_uint32
Definition: nvos_static_analysis.h:272
SubU16
static bool SubU16(uint16_t op1, uint16_t op2, uint16_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:636
AddU16WithExit
static void AddU16WithExit(uint16_t op1, uint16_t op2, uint16_t *result)
Exit API is not supported in LK and BL.
Definition: nvos_static_analysis.h:731
ERR_INT30_C_ADDU32UPTR
#define ERR_INT30_C_ADDU32UPTR
Definition: nvos_static_analysis.h:239
ERR_INT32_C_DIVS64
#define ERR_INT32_C_DIVS64
Definition: nvos_static_analysis.h:224
CastU64toU8WithExit
static uint8_t CastU64toU8WithExit(uint64_t op)
Definition: nvos_static_analysis.h:1103
DivS64WithExit
static void DivS64WithExit(int64_t op1, int64_t op2, int64_t *result)
Definition: nvos_static_analysis.h:1044
ERR_INT32_C_SUBS32
#define ERR_INT32_C_SUBS32
Definition: nvos_static_analysis.h:219
CastU32toCharWithExit
static char CastU32toCharWithExit(uint32_t op)
Definition: nvos_static_analysis.h:1094
incrementUInt64
static void incrementUInt64(uint64_t *x)
Increment uint64_t by one Precondition test to ensure value is within RANGE_MAX.
Definition: nvos_static_analysis.h:456
min
#define min(a, b)
Definition: nvmnand_mmc_util.h:25
NvConvertUint32toInt64
static void NvConvertUint32toInt64(uint32_t op, int64_t *result)
MISRA RULE 10.8 Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1253
max
#define max(a, b)
Definition: nvmnand_mmc_util.h:24
ERR_INT30_C_ADDU32
#define ERR_INT30_C_ADDU32
Definition: nvos_static_analysis.h:211
AddU32UPTRWithExit
static void AddU32UPTRWithExit(uintptr_t op1, uint32_t op2, uintptr_t *result)
CERT INT30-C: Precondition test to ensure that uintptr_t and unsigned integer add operation do not wr...
Definition: nvos_static_analysis.h:780
CastS64toS32WithExit
static int32_t CastS64toS32WithExit(int64_t op)
Definition: nvos_static_analysis.h:1166
ERR_INT31_C_CAST_S64TOS32
#define ERR_INT31_C_CAST_S64TOS32
Definition: nvos_static_analysis.h:236
ERR_INT30_C_SUBU32
#define ERR_INT30_C_SUBU32
Definition: nvos_static_analysis.h:213
CastS32toU8WithExit
static uint8_t CastS32toU8WithExit(int32_t op)
Definition: nvos_static_analysis.h:1148
ERR_INT31_C_CAST_U64TOS32
#define ERR_INT31_C_CAST_U64TOS32
Definition: nvos_static_analysis.h:230
SubSizet
static bool SubSizet(size_t op1, size_t op2, size_t *result)
CERT INT30-C: Precondition test to ensure that size_t subtraction operation do not wrap.
Definition: nvos_static_analysis.h:708
NvConvertLint64toInt32
static bool NvConvertLint64toInt32(int64_t op, int32_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1343
CastU64toS64WithExit
static int64_t CastU64toS64WithExit(uint64_t op)
Definition: nvos_static_analysis.h:1178
AddU64
static bool AddU64(uint64_t op1, uint64_t op2, uint64_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer add operation do not wrap.
Definition: nvos_static_analysis.h:348
SubS32
static bool SubS32(int32_t op1, int32_t op2, int32_t *result)
CERT INT32-C: Precondition test to ensure that signed integer subtraction operation does not overflow...
Definition: nvos_static_analysis.h:653
AddUPTRSizetWithExit
static void AddUPTRSizetWithExit(uintptr_t op1, size_t op2, uintptr_t *result)
CERT INT30-C: Precondition test to ensure that uintptr_t and size_t add operation do not wrap.
Definition: nvos_static_analysis.h:817
ERR_INT31_C_CAST_U32TOS32
#define ERR_INT31_C_CAST_U32TOS32
Definition: nvos_static_analysis.h:226
CastU32toS32WithExit
static int32_t CastU32toS32WithExit(uint32_t op)
Definition: nvos_static_analysis.h:1067
CastU32toU8WithExit
static uint8_t CastU32toU8WithExit(uint32_t op)
Definition: nvos_static_analysis.h:1085
ERR_INT31_C_CAST_U64TOU32
#define ERR_INT31_C_CAST_U64TOU32
Definition: nvos_static_analysis.h:229
NvConvertUint32toUint16
static bool NvConvertUint32toUint16(uint32_t op, uint16_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1263
CastU64toU32
static bool CastU64toU32(uint64_t op1, uint32_t *result)
CERT INT30-C: Precondition test to ensure casting unsigned long to unsigned integer do not wrap.
Definition: nvos_static_analysis.h:427
CastU32toS32
static bool CastU32toS32(uint32_t op1, int32_t *result)
CERT INT30-C: Precondition test to ensure casting unsigned integer to signed integer do not wrap.
Definition: nvos_static_analysis.h:485
CastS32toU64WithExit
static uint64_t CastS32toU64WithExit(int32_t op)
Definition: nvos_static_analysis.h:1139
flag_converter::flag_int32
int32_t flag_int32
Definition: nvos_static_analysis.h:271
NvConvertUint64toInt64
static bool NvConvertUint64toInt64(uint64_t op, int64_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1238
CastS32toU16
static bool CastS32toU16(int32_t op1, uint16_t *result)
CERT INT30-C: Precondition test to ensure casting signed integer to unsigned integer do not wrap.
Definition: nvos_static_analysis.h:517
ERR_INT31_C_CAST_U32TOU16
#define ERR_INT31_C_CAST_U32TOU16
Definition: nvos_static_analysis.h:227
MultU32WithExit
static void MultU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:886
CastU64toU32WithExit
static uint32_t CastU64toU32WithExit(uint64_t op)
Definition: nvos_static_analysis.h:1112
NvConvertUint64toUint32
static bool NvConvertUint64toUint32(uint64_t op, uint32_t *result)
CERT INT31-C: Ensure that integer conversions do not result in lost or misinterpreted data.
Definition: nvos_static_analysis.h:1222
NVOS_COV_WHITELIST
#define NVOS_COV_WHITELIST(type, checker, comment_str)
Definition: nvos_static_analysis.h:199
ERR_INT31_C_CAST_S32TOU8
#define ERR_INT31_C_CAST_S32TOU8
Definition: nvos_static_analysis.h:234
ERR_INT31_C_CAST_S64TOU32
#define ERR_INT31_C_CAST_S64TOU32
Definition: nvos_static_analysis.h:232
SubSizetWithExit
static void SubSizetWithExit(size_t op1, size_t op2, size_t *result)
CERT INT30-C: Precondition test to ensure that size_t subtraction operation do not wrap.
Definition: nvos_static_analysis.h:958
CastU64toS32
static bool CastU64toS32(uint64_t op1, int32_t *result)
CERT INT30-C: Precondition test to ensure casting unsigned long to unsigned integer do not wrap.
Definition: nvos_static_analysis.h:469
MultU32
static bool MultU32(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:380
ERR_INT31_C_CAST_S32TOU32
#define ERR_INT31_C_CAST_S32TOU32
Definition: nvos_static_analysis.h:231
AddU16
static bool AddU16(uint16_t op1, uint16_t op2, uint16_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer add operation do not wrap.
Definition: nvos_static_analysis.h:282
ERR_INT30_C_ADDU32VPTR
#define ERR_INT30_C_ADDU32VPTR
Definition: nvos_static_analysis.h:240
ERR_INT31_C_CAST_U64TOU8
#define ERR_INT31_C_CAST_U64TOU8
Definition: nvos_static_analysis.h:225
VA_ADDR_MASK
#define VA_ADDR_MASK
Define macro for virtual address bit mask.
Definition: nvos_static_analysis.h:246
MultS64
static bool MultS64(int64_t op1, int64_t op2, int64_t *result)
CERT INT30-C Precondition test to ensure that signed integer multiplication operation do not wrap.
Definition: nvos_static_analysis.h:585
AddS64
static bool AddS64(int64_t op1, int64_t op2, int64_t *result)
CERT INT30-C Precondition test to ensure that integer add operation do not wrap.
Definition: nvos_static_analysis.h:362
ERR_INT32_C_ADDS32
#define ERR_INT32_C_ADDS32
Definition: nvos_static_analysis.h:217
SubU32WithExit
static void SubU32WithExit(uint32_t op1, uint32_t op2, uint32_t *result)
CERT INT30-C: Precondition test to ensure that unsigned integer subtraction operation do not wrap.
Definition: nvos_static_analysis.h:924
CastS32toU32
static bool CastS32toU32(int32_t op1, uint32_t *result)
CERT INT30-C: Precondition test to ensure casting signed integer to unsigned integer do not wrap.
Definition: nvos_static_analysis.h:501