Commit 9131d6a7 authored by Nir Lichtman's avatar Nir Lichtman Committed by Daniel Thompson
Browse files

kdb: Remove fallback interpretation of arbitrary numbers as hex



Remove logic that enables a fallback of interpreting numbers supplied in KDB CLI
to be interpreted as hex without explicit "0x" prefix as this can be confusing
for the end users.

Suggested-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarNir Lichtman <nir@lichtman.org>
Link: https://lore.kernel.org/r/20241028192228.GC918454@lichtman.org


Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
parent 0c10cc24
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -402,23 +402,15 @@ static void kdb_printenv(void)
 */
int kdbgetularg(const char *arg, unsigned long *value)
{
	/*
	 * If the first fails, also try base 16, for us
	 * folks too lazy to type the leading 0x...
	 */
	if (kstrtoul(arg, 0, value)) {
		if (kstrtoul(arg, 16, value))
	if (kstrtoul(arg, 0, value))
		return KDB_BADINT;
	}
	return 0;
}

int kdbgetu64arg(const char *arg, u64 *value)
{
	if (kstrtou64(arg, 0, value)) {
		if (kstrtou64(arg, 16, value))
	if (kstrtou64(arg, 0, value))
		return KDB_BADINT;
	}
	return 0;
}