|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V4 6/8] iommu/arm: Add lightweight iommu_fwspec support
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.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |