common: eeprom_field: Fix updating binary field

The __eeprom_field_update_bin() function is expected to parse a hex
string into bytes (potentially in reverse order), but the
simple_strtoul() function is given 0 as base. This does not work since
the string does not contain '0x' prefix. Add explicit base 16.

Signed-off-by: Marek Behún <kabel@kernel.org>
This commit is contained in:
Marek Behún
2024-06-07 10:47:59 -06:00
committed by Tom Rini
parent 15378a3fe1
commit 96dfa5869d
+1 -1
View File
@@ -55,7 +55,7 @@ static int __eeprom_field_update_bin(struct eeprom_field *field,
tmp[k] = value[reverse ? i - 1 + k : i + k];
}
byte = simple_strtoul(tmp, &endptr, 0);
byte = simple_strtoul(tmp, &endptr, 16);
if (*endptr != '\0' || byte < 0)
return -1;