Re: [PATCH] btrfs: validate scrub_speed_max sysfs string

David Disseldorp
2023-12-11T03:57:06Z

On Mon, 11 Dec 2023 13:48:15 +1030, Qu Wenruo wrote:

> On 2023/12/8 11:11, David Disseldorp wrote:
> > Fail the sysfs I/O on any trailing non-space characters.
> >
> > Signed-off-by: David Disseldorp <ddiss@suse.de>
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks.

> Although I have an unrelated idea.
>
> Since memparse() provides the @endptr, can we rewind the @endptr, so
> that we can check if the last valid charactor is suffix 'e'.
> Then reject it from btrfs size.

Hmm we could do that, but then we'd also break hex parsing. Rejecting
'e' in the absence of a leading '0x' or '0X' would work, but it's a bit
ugly.

Cheers, David