Re: [PATCH v2] fault-injection: Enhance failcmd to exit on non-hex address input
From: Akinobu Mita
Date: Tue Jul 30 2024 - 10:06:00 EST
2024年7月29日(月) 17:45 Breno Leitao <leitao@xxxxxxxxxx>:
>
> The failcmd.sh script in the fault-injection toolkit does not currently
> validate whether the provided address is in hexadecimal format. This can
> lead to silent failures if the address is sourced from places like
> `/proc/kallsyms`, which omits the '0x' prefix, potentially causing users
> to operate under incorrect assumptions.
>
> Introduce a new function, `exit_if_not_hex`, which checks the format of
> the provided address and exits with an error message if the address is
> not a valid hexadecimal number.
>
> This enhancement prevents users from running the command with
> improperly formatted addresses, thus improving the robustness and
> usability of the failcmd tool.
>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
Looks good.
Reviewed-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>