The commit is pushed to "branch-rh10-6.12.0-55.52.1.4.x.vz10-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.4.12.vz10
------>
commit 34c7b3fad5d695819e93d01e799802ed2fae3e30
Author: Konstantin Khorenko <[email protected]>
Date: Mon Mar 23 21:31:24 2026 +0100
selftests/iommu: suppress -Warray-bounds in _test_cmd_get_hw_info
In function '_test_cmd_get_hw_info',
inlined from 'iommufd_ioas_get_hw_info' at iommufd.c:614:3,
inlined from 'wrapper_iommufd_ioas_get_hw_info' at iommufd.c:589:1:
iommufd_utils.h:683:37: warning: array subscript 'struct
iommu_test_hw_info[0]' is partly outside array bounds of 'struct
iommu_test_hw_info_buffer_smaller[1]' [-Warray-bounds=]
683 | assert(!info->flags);
| ~~~~^~~~~~~
The test intentionally passes a smaller buffer to exercise the kernel's
handling of undersized user buffers. Runtime data_len checks make the
access safe, but GCC cannot prove this statically. Suppress the warning
locally with a pragma.
https://virtuozzo.atlassian.net/browse/VSTOR-127529
Signed-off-by: Konstantin Khorenko <[email protected]>
Reviewed-by: Vasileios Almpanis <[email protected]>
Feature: fix selftests
---
tools/testing/selftests/iommu/iommufd_utils.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/iommu/iommufd_utils.h
b/tools/testing/selftests/iommu/iommufd_utils.h
index 40f6f14ce136f..1c65c1cde8143 100644
--- a/tools/testing/selftests/iommu/iommufd_utils.h
+++ b/tools/testing/selftests/iommu/iommufd_utils.h
@@ -676,12 +676,19 @@ static int _test_cmd_get_hw_info(int fd, __u32 device_id,
void *data,
}
}
+ /*
+ * When data_len is smaller than sizeof(*info), GCC warns about
+ * out-of-bounds access. The runtime data_len checks make this safe.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
if (info) {
if (data_len >= offsetofend(struct iommu_test_hw_info,
test_reg))
assert(info->test_reg == IOMMU_HW_INFO_SELFTEST_REGVAL);
if (data_len >= offsetofend(struct iommu_test_hw_info, flags))
assert(!info->flags);
}
+#pragma GCC diagnostic pop
if (capabilities)
*capabilities = cmd.out_capabilities;
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel