]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommufd/driver: Fix counter initialization for counted_by annotation
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 11 Nov 2025 09:01:24 +0000 (18:01 +0900)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 21 Nov 2025 19:38:27 +0000 (15:38 -0400)
commitac84ff453305d12bc799074a9f9af30ff97fff70
tree93e0b0e45b131f74c17e20393b9d8e0efa6d7df1
parent6a23ae0a96a600d1d12557add110e0bb6e32730c
iommufd/driver: Fix counter initialization for counted_by annotation

One of the requirements for counted_by annotations is that the counter
member must be initialized before the first reference to the
flexible-array member.

Move the vevent->data_len = data_len; initialization to before the
first access to flexible array vevent->event_data.

Link: https://patch.msgid.link/r/aRL7ZFFqM5bRTd2D@kspp
Cc: stable@vger.kernel.org
Fixes: e8e1ef9b77a7 ("iommufd/viommu: Add iommufd_viommu_report_event helper")
Signed-off-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/driver.c