On 2018年07月13日 22:34, David Sterba wrote:
> On Thu, Jul 12, 2018 at 02:19:07PM +0800, Qu Wenruo wrote:
>> Introduce a new macro based compile time check for ioctl structures.
>>
>> The new macro is BTRFS_ASSERT_SIZE(), which is mostly copied from
>> VMMDEV_ASSERT_SIZE().
>
> The macro should be generic, there's nothing specific to btrfs. There's
> a similar one in the progs.
>
>> Such check is only added to structure pended to power of 2.
>
> There's no constraint about power of 2 sizes, it works for any size.
While some structure doesn't do padding at all, and it looks like they
may get expanded later.
Do we really need to limit the size right now?
>
>> And exposed one structure, btrfs_ioctl_get_dev_stats() is not aligned
>> well.
>> The misalign is introduced by commit b27f7c0c150f ("btrfs: join DEV_STATS
>> ioctls to one").
>
> Yeah, that was an oversight, so the correct value to check against is
> 1024 + 8 = 1032, see ioctl.h in progs.
Can't we just revert to 1024?
That plus 8 doesn't really look well, and shrink the size shouldn't
bring any problem AFAIK.
Thanks,
Qu
>
Attachment:
signature.asc
Description: OpenPGP digital signature
