Le ven. 17 mai 2024, 21:26, Gao Xiang <hsiangkao@linux.alibaba.com
<mailto:hsiangkao@linux.alibaba.com>> a écrit :
Hi Vladimir,
On 2024/5/18 00:38, Vladimir 'phcoder' Serbinenko wrote:
> I think that given that align is a non zero const we can trust it.
From the EROFS specific cases, they are always non-zero values,
So I agree with you on this..
Yet Daniel said ".. Be careful with underflows too." in
Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl">https://lore.kernel.org/r/Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl
<Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl">https://lore.kernel.org/r/Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl>
although I'm not quite sure but I guess like this.
Also as a generic helper, I think `align` could be zero if it's
a variable..
It's rare for align to be a variable and then additional checks are needed that
align is a power of 2. And power of 2 is never zero. This check is better done
on the caller side. You just need a comment specify that it's caller
responsibility to check it.