[lvc-project] [PATCH] ocfs2: add directory size check to ocfs2_find_dir_space_id()
Heming Zhao
heming.zhao at suse.com
Fri Oct 17 01:20:28 MSK 2025
On 10/16/25 23:25, Dmitry Antipov wrote:
> On 10/16/25 2:58 PM, Heming Zhao wrote:
>
>>> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
>>> index b9bf1428a3d9..3c2dacba9b0a 100644
>>> --- a/fs/ocfs2/dir.c
>>> +++ b/fs/ocfs2/dir.c
>>> @@ -3444,6 +3444,14 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
>>> offset += le16_to_cpu(de->rec_len);
>>> }
>>> + if (!last_de) {
>>> + ret = ocfs2_error(sb, "Directory entry (#%llu: size=%lld) "
>>> + "is unexpectedly short",
>>> + (unsigned long long)OCFS2_I(dir)->ip_blkno,
>>> + i_size_read(dir));
>>> + goto out;
>>> + }
>>> +
>>
>> The 'goto' will use the uninitialized value of 'ret'.
>> The others look good to me.
>
> Hmmm... 'ret' is explicitly initialized with 'ocfs2_error(...)',
> which is expected to return either -EIO or -EROFS.
>
> Dmitry
>
My mistake, the code is correct.
- Heming
More information about the lvc-project
mailing list