27 строки
1.0 KiB
Diff
27 строки
1.0 KiB
Diff
diff --git a/include/linux-i386/sysdep.h b/include/linux-i386/sysdep.h
|
|
index ef99d1d..be065e9 100644
|
|
--- a/include/linux-i386/sysdep.h
|
|
+++ b/include/linux-i386/sysdep.h
|
|
@@ -104,11 +104,19 @@ static __inline__ uint32_t ips_cmpxchg(volatile uint32_t *ptr,
|
|
uint32_t old, uint32_t new)
|
|
{
|
|
uint32_t prev;
|
|
- struct xchg_dummy { uint32_t a[100]; };
|
|
|
|
+ /* This code used to cast PTR to a type which was an array of 100
|
|
+ uint32_t objects. That makes no sense as the cmpxchgl's side
|
|
+ effect can be covered by an single int.
|
|
+
|
|
+ The semantics of GCC's ASMs for memory is that it clobbers the
|
|
+ whole pointed-to object. Thus analyzers saw a 100 uint32_t sized
|
|
+ store which triggers diagnostics for out of bounds array writes.
|
|
+
|
|
+ The cast to the dummy type has been removed. */
|
|
asm volatile(LOCK_PREFIX "cmpxchgl %1,%2"
|
|
: "=a"(prev)
|
|
- : "q"(new), "m"(*(struct xchg_dummy *)ptr), "0"(old)
|
|
+ : "q"(new), "m"(*ptr), "0"(old)
|
|
: "memory");
|
|
|
|
return prev;
|