Skip to content

Commit

Permalink
Upgrade to warning when name is truncated
Browse files Browse the repository at this point in the history
Signal to users that the name field may not produce the expected string
if the chipset name and revision exceeds the maximum size of the buffer.
In practice, this is unlikely as the buffer size is reasonably high for
a chipset name/revision.
  • Loading branch information
prashanthswami committed Jan 11, 2024
1 parent 76cc10d commit 7788814
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arm/linux/cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ static bool parse_line(
} else if (memcmp(line_start, "Hardware", key_length) == 0) {
size_t value_length = value_end - value_start;
if (value_length > CPUINFO_HARDWARE_VALUE_MAX) {
cpuinfo_log_info(
cpuinfo_log_warning(
"length of Hardware value \"%.*s\" in /proc/cpuinfo exceeds limit (%d): truncating to the limit",
(int)value_length,
value_start,
Expand All @@ -888,7 +888,7 @@ static bool parse_line(
} else if (memcmp(line_start, "Revision", key_length) == 0) {
size_t value_length = value_end - value_start;
if (value_length > CPUINFO_REVISION_VALUE_MAX) {
cpuinfo_log_info(
cpuinfo_log_warning(
"length of Revision value \"%.*s\" in /proc/cpuinfo exceeds limit (%d): truncating to the limit",
(int)value_length,
value_start,
Expand Down

0 comments on commit 7788814

Please sign in to comment.