Commit Graph

4 Commits

Author SHA1 Message Date
Philip Elcan
039ec0b3da gpu: nvgpu: whitelist CERT-C STR34-C in static_analysis.h
Whitelist CERT-C violation STR34-C in nvgpu_safe_cast_s8_to_u8(). This
violation is being reported due to a bug in the Coverity scanner and
is tracked by nvbug 2673832.

JIRA NVGPU-4031

Change-Id: Ia6b897d162f945836d3da00e539dc59e0fceb1bf
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2198903
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Nitin Kumbhar
ecc3ad902f gpu: nvgpu: add checks for precision of integers
Add safety checks to validate precision of unsigned types.
These validations are used to justify that no security issues
exist in NvGPU driver due to CERT-C INT34-C and INT35-C
violations.

These are done early in the driver probe to ensure that
code violating CERT-C INT34-C and INT35-C rules is not run
before these checks.

JIRA NVGPU-3908
JIRA NVGPU-3561

Change-Id: Iffb8e21935d16f31c52af909689c334bc120cf7c
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2195033
Reviewed-by: Philip Elcan <pelcan@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>
2020-12-15 14:05:52 -06:00
Adeel Raza
62c5941a71 gpu: nvgpu: whitelisting doxygen cleanup
Do some doxygen cleanup for the whitelisting macros:
   - Previously doxygen documentation was being generated for the no-op
     whitelisting macros. Enable the NV_IS_COVERITY define in the
     doxygen build. This generates doxygen documentation for the actual
     whitelisting macros.
   - Create a doxygen group for the whitelisting macros. This adds
     additional documentation for the whitelisting macros.
   - Add doxygen line breaks

JIRA NVGPU-3820

Change-Id: Id452147a3a909da7981303d0908f2aff4a2ff86b
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2194711
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Adeel Raza
252ddc4f05 gpu: nvgpu: add coverity whitelisting support
Add macros for whitelisting coverity violations. These macros use pragma
directives. The pragma directives and whitelisting macros are only
enabled when a coverity scan is being run.

The whitelisting macros have been added to a new header called
static_analysis.h. The contents of safe_ops.h (CERT C safe ops) have
been moved into static_analysis.h because this will be the new header
for static analysis related macros/defines/etc.

JIRA NVGPU-3820

Change-Id: I9c63f20f670880b420415535738034619314b7c3
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2180600
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00