Skip to content

Commit ac84ff4

Browse files
GustavoARSilvajgunthorpe
authored andcommitted
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: [email protected] Fixes: e8e1ef9 ("iommufd/viommu: Add iommufd_viommu_report_event helper") Signed-off-by: "Gustavo A. R. Silva" <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 6a23ae0 commit ac84ff4

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)