Re: [PATCH -next v2] fs-verity: Use struct_size() helper in enable_verity()

From: zhangjianhua (E)
Date: Thu May 19 2022 - 02:22:50 EST


Thanks, I will do more work about sparse and maybe find some answers.


Zhang Jianhua

在 2022/5/19 12:22, Eric Biggers 写道:
[Please use reply all, not just reply!]

On Thu, May 19, 2022 at 11:54:48AM +0800, zhangjianhua (E) wrote:
Hi Eric

The warnings in commit message are from the build log in Jan 2022, and I
find these sizeof are still here, so I submit

these two patches. I build the kernel just now and encounter the same
situation with you, there are lots of warnings.

Maybe you are right, there should be some mechanism to solve this problem
completely.


I've updated the commit message and applied this patch, but not the other one,
as the other one wasn't actually dealing with a variable length which made it
pretty much pointless, as I mentioned.

If you'd like to look into making sparse enable this warning by default, I'd
certainly encourage you to do so. But it looks like the warning itself could
use some more work. It probably should only warn if the
sizeof(struct_with_flexible_array) is actually being added to another value, and
where that value is not a compile-time constant.

- Eric
.