mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: posix: fix EXP32 CERT C violation
Do not ignore volatile attribute of addr while assigning it to p. Error: CERT EXP32-C: drivers/gpu/nvgpu/os/posix/bitmap.c:227: cert_violation: Access volatile variable "addr" through a nonvolatile reference. Jira NVGPU-3560 Change-Id: I202b143e1818641b12f6552810953ac447348271 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2122720 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
97a4a76936
commit
69331cdfb7
@@ -216,7 +216,8 @@ bool test_and_set_bit(int nr, volatile unsigned long *addr)
|
||||
bool test_and_clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
volatile unsigned long *p =
|
||||
((volatile unsigned long *)addr) + BIT_WORD(nr);
|
||||
|
||||
return (atomic_fetch_and(p, ~mask) & mask) != 0ULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user