Re: [PATCH] fat: Optimized FAT bad char check

From: OGAWA Hirofumi
Date: Thu Apr 10 2025 - 09:49:10 EST


zhoumin <teczm@xxxxxxxxxxx> writes:

> Hi Hirofumi
>
>> Why do you need this change?
>
> I encountered an issue while working on our own bootloader. The problem
> occurs when short file names start with `0`. In this case, our bootloader
> mistakenly interprets it as the end of the directory entry, causing all
> subsequent files in the directory to become invisible.

It is normal behavior of Windows.

> While comparing our bootloader with the kernel, I found this bad char check
> function. Treating the `0x05` deleted flag as a bad character may
> potentially disrupt the parsing chain for subsequent files.
>
> In my opinion, adding this judgment aligns with the spec and should not
> introduce any negative side effects, even though I haven’t encountered this
> situation in practice.

What specific case are you saying? This path is checking the user
input, isn't it? Why do you allow to create that filename includes 0 or 5?

Looks like you are overlooking something.

Thanks.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>