Commit 0c10cc24 authored by Yuran Pereira's avatar Yuran Pereira Committed by Daniel Thompson
Browse files

trace: kdb: Replace simple_strtoul with kstrtoul in kdb_ftdump

The function simple_strtoul performs no error checking in scenarios
where the input value overflows the intended output variable.
This results in this function successfully returning, even when the
output does not match the input string (aka the function returns
successfully even when the result is wrong).

Or as it was mentioned [1], "...simple_strtol(), simple_strtoll(),
simple_strtoul(), and simple_strtoull() functions explicitly ignore
overflows, which may lead to unexpected results in callers."
Hence, the use of those functions is discouraged.

This patch replaces all uses of the simple_strtoul with the safer
alternatives kstrtoint and kstrtol.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull



Signed-off-by: default avatarYuran Pereira <yuran.pereira@hotmail.com>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
[nir: style fixes]
Signed-off-by: default avatarNir Lichtman <nir@lichtman.org>
Link: https://lore.kernel.org/r/20241028192100.GB918454@lichtman.org


Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
parent 120fb87c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment