On 17.09.19 09:12, Jan Beulich wrote:
Hi, Jan
On 16.09.2019 20:08, Oleksandr wrote:
On 16.09.19 13:40, Jan Beulich wrote:
+/* per-device IOMMU instance data */
+struct iommu_fwspec {
+ /* this device's IOMMU */
+ struct device *iommu_dev;
+ /* IOMMU driver private data for this device */
+ void *iommu_priv;
+ /* number of associated device IDs */
+ unsigned int num_ids;
+ /* IDs which this device may present to the IOMMU */
+ uint32_t ids[1];
+};
Note that you abuse xrealloc_flex_struct() when using it with such
a type: The last field is _not_ a flexible array member. Compilers
might legitimately warn if they can prove that you access
p->ids[1] anywhere, despite you (presumably) having allocated enough
space. (I haven't been able to think of a way for the macro to
actually detect and hence refuse such wrong uses.)
Indeed, you are right. I am in doubt, whether to retain ported from
Linux code (ids[1])
and mention about such abuse or change it to deal with real flexible
array member (ids[]). Any thoughts?
I'm of the strong opinion that you should switch to [] (or at
least [0]) notation.
I got it. Well, will switch to ids[] if there are no objections.
Thank you.
--
Regards,
Oleksandr Tyshchenko
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel