[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251210211342.989850-1-katharasasikumar007@gmail.com>
Date: Wed, 10 Dec 2025 21:13:42 +0000
From: Kathara Sasikumar <katharasasikumar007@...il.com>
To: jgg@...pe.ca, kevin.tian@...el.com, shuah@...nel.org
Cc: iommu@...ts.linux.dev, linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org, yi.l.liu@...el.com, nicolinc@...dia.com, alex.williamson@...hat.com, katharaasasikumar007@...il.com, Kathara Sasikumar <katharasasikumar007@...il.com>
Subject: [PATCH] selftests: iommu: fix Warray-bounds in get_hw_info test
The get_hw_info uses a smaller user buffer on purpose to check how
the kernel updates only the fields that fit in the buffer. The test
created a custom smaller struct for this, but the helper function later
treats the buffer as struct iommu_test_hw_info. This makes the compiler
warn about a possible out-of-bounds access (-Warray-bounds).
This keeps the test behavior the same and removes the warning.
Signed-off-by: Kathara Sasikumar <katharasasikumar007@...il.com>
---
tools/testing/selftests/iommu/iommufd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selftests/iommu/iommufd.c
index 10e051b6f592..f6aceb65313f 100644
--- a/tools/testing/selftests/iommu/iommufd.c
+++ b/tools/testing/selftests/iommu/iommufd.c
@@ -755,9 +755,7 @@ TEST_F(iommufd_ioas, get_hw_info)
struct iommu_test_hw_info info;
uint64_t trailing_bytes;
} buffer_larger;
- struct iommu_test_hw_info_buffer_smaller {
- __u32 flags;
- } buffer_smaller;
+ struct iommu_test_hw_info buffer_smaller;
if (self->device_id) {
uint8_t max_pasid = 0;
--
2.51.0
Powered by blists - more mailing lists