Skip to contentSkip to conversation

x86/events/amd/iommu: Increase IOMMU_NAME_SIZE

PATCH Applied Andy Shevchenko 2 participants 2 messages Feb 10, 2025 – Feb 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/events/amd/iommu: Increase IOMMU_NAME_SIZE

The init_one_iommu() takes an unsigned int argument that can't be checked for the boundaries at compile time and GCC complains about that when build with make W=1:

arch/x86/events/amd/iommu.c:441:53: note: directive argument in the range [0, 4294967294] arch/x86/events/amd/iommu.c:441:9: note: ‘snprintf’ output between 12 and 21 bytes into a destination of size 16

Increase the size to cover all possible cases.

---
 arch/x86/events/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/amd/iommu.c +1 -1
index b15f7b950d2e..f8228d8243f7 100644
@@ -30,7 +30,7 @@
 #define GET_DOMID_MASK(x)  (((x)->conf1 >> 16) & 0xFFFFULL)
 #define GET_PASID_MASK(x)  (((x)->conf1 >> 32) & 0xFFFFFULL)
 
-#define IOMMU_NAME_SIZE 16
+#define IOMMU_NAME_SIZE 24
 
 struct perf_amd_iommu {
 	struct list_head list;
Signature · 1 line
2.45.1.3035.g276e886db78b
#1 lore raw
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     1623ced247f7cb1b48a27cca6b0f17fe5ab5942b
Gitweb:        https://git.kernel.org/tip/1623ced247f7cb1b48a27cca6b0f17fe5ab5942b
Author:        Andy Shevchenko <[email protected]>
AuthorDate:    Mon, 10 Feb 2025 21:34:12 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Fri, 14 Feb 2025 10:32:02 +01:00

x86/events/amd/iommu: Increase IOMMU_NAME_SIZE

The init_one_iommu() takes an unsigned int argument that can't be checked for the boundaries at compile time and GCC complains about that when build with make W=1:

arch/x86/events/amd/iommu.c:441:53: note: directive argument in the range [0, 4294967294] arch/x86/events/amd/iommu.c:441:9: note: ‘snprintf’ output between 12 and 21 bytes into a destination of size 16

Increase the size to cover all possible cases.

---
 arch/x86/events/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/amd/iommu.c +1 -1
index b15f7b9..f8228d8 100644
@@ -30,7 +30,7 @@
 #define GET_DOMID_MASK(x)  (((x)->conf1 >> 16) & 0xFFFFULL)
 #define GET_PASID_MASK(x)  (((x)->conf1 >> 32) & 0xFFFFFULL)
 
-#define IOMMU_NAME_SIZE 16
+#define IOMMU_NAME_SIZE 24
 
 struct perf_amd_iommu {
 	struct list_head list;