Blame SOURCES/libpsm2-gcc11.patch

cb411c
diff -Nrup a/include/linux-i386/sysdep.h b/include/linux-i386/sysdep.h
cb411c
--- a/include/linux-i386/sysdep.h	2019-10-03 20:00:29.000000000 -0600
cb411c
+++ b/include/linux-i386/sysdep.h	2020-10-19 16:10:45.680585173 -0600
cb411c
@@ -139,12 +139,18 @@ static __inline__ uint32_t ips_cmpxchg(v
cb411c
 				       uint32_t old_val, uint32_t new_val)
cb411c
 {
cb411c
 	uint32_t prev;
cb411c
-	struct xchg_dummy {
cb411c
-		uint32_t a[100];
cb411c
-	};
cb411c
 
cb411c
+	/* This code used to cast PTR to a type which was an array of 100
cb411c
+	   uint32_t objects.  That makes no sense as the cmpxchgl's side
cb411c
+	   effect can be covered by an single int.
cb411c
+
cb411c
+	   The semantics of GCC's ASMs for memory is that it clobbers the
cb411c
+	   whole pointed-to object.  Thus analyzers saw a 100 uint32_t sized
cb411c
+	   store which triggers diagnostics for out of bounds array writes.
cb411c
+
cb411c
+	   The cast to the dummy type has been removed.  */
cb411c
 	asm volatile (LOCK_PREFIX "cmpxchgl %1,%2" : "=a"(prev)
cb411c
-		      : "q"(new_val), "m"(*(struct xchg_dummy *)ptr), "0"(old_val)
cb411c
+		      : "q"(new_val), "m"(*ptr), "0"(old_val)
cb411c
 		      : "memory");
cb411c
 
cb411c
 	return prev;