Re: [PATCH 1/5] fs/filesystems: Fix potential unsigned integer underflow in fs_name()
From: Zijun Hu
Date: Fri Apr 11 2025 - 12:07:29 EST
On 2025/4/11 23:34, David Howells wrote:
>> Fix by breaking the for loop when '@index == 0' which is also more proper
>> than '@index <= 0' for unsigned integer comparison.
> There isn't really a risk. The list walked by "tmp" and the checks that this
> is or is not NULL will prevent a problem.
>
no fixes tag is added and just improve code logic a bit since there is
no reason to continue the loop when @index reach 0.
> I also feel that breaking out of the loop with "<= 0" - even if the variable
> is unsigned - is safer, on the off chance that someone in the future changes
> the signedness of the variable.
for parameter @index representing filesystem index. unsigned integer
type may be better than signed.