Skip to content

Commit a158944

Browse files
committed
iommufd/driver: Fix counter initialization for counted_by annotation
JIRA: https://issues.redhat.com/browse/RHEL-131315 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit ac84ff4 Author: Gustavo A. R. Silva <gustavoars@kernel.org> Date: Tue Nov 11 18:01:24 2025 +0900 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: e8e1ef9 ("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> Signed-off-by: Eder Zulian <ezulian@redhat.com>
1 parent fb22a29 commit a158944

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/iommufd/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ int iommufd_viommu_report_event(struct iommufd_viommu *viommu,
161161
vevent = &veventq->lost_events_header;
162162
goto out_set_header;
163163
}
164-
memcpy(vevent->event_data, event_data, data_len);
165164
vevent->data_len = data_len;
165+
memcpy(vevent->event_data, event_data, data_len);
166166
veventq->num_events++;
167167

168168
out_set_header:

0 commit comments

Comments
 (0)