git: 57775b3be6be - main - arm64/smmu: Fix undefined behaviour in Q_OVF
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Aug 2026 11:33:29 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=57775b3be6be253f3612f5b0a74dc9bf2b36d6d7
commit 57775b3be6be253f3612f5b0a74dc9bf2b36d6d7
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2026-07-28 14:04:50 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2026-08-26 11:31:36 +0000
arm64/smmu: Fix undefined behaviour in Q_OVF
"1 << 31" is a signed int left shift 31 which is undefined as the shift
is too large. Use an unsigned int to make the value defined.
Sponsored by: Arm Ltd
---
sys/arm64/iommu/smmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 2d34b9177ed7..9a6f15e83def 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -142,7 +142,7 @@
#define Q_WRP(q, p) ((p) & (1 << (q)->size_log2))
#define Q_IDX(q, p) ((p) & ((1 << (q)->size_log2) - 1))
-#define Q_OVF(p) ((p) & (1 << 31)) /* Event queue overflowed */
+#define Q_OVF(p) ((p) & (1u << 31)) /* Event queue overflowed */
#define SMMU_Q_ALIGN (64 * 1024)