mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-04 14:01:54 +00:00
npcx: Fix termination of chip revision
system_get_chip_revision() would return a string which lacked the terminating null. Increase the string length and enforce termination. BUG=chromium:511405 BRANCH=none TEST=version; should show chip revision without garbage chars at end Change-Id: Icb9e36c5bfdf7de7400e5316934ccf28b4b57898 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/290392 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Tested-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
5dde472951
commit
23aa59d35f
@@ -541,7 +541,7 @@ const char *system_get_chip_name(void)
|
||||
|
||||
const char *system_get_chip_revision(void)
|
||||
{
|
||||
static char rev[4];
|
||||
static char rev[5];
|
||||
/* Read ROM data for chip revision directly */
|
||||
uint8_t rev_num = *((uint8_t *)CHIP_REV_ADDR);
|
||||
|
||||
@@ -549,6 +549,7 @@ const char *system_get_chip_revision(void)
|
||||
*(rev + 1) = '.';
|
||||
*(rev + 2) = system_to_hex((rev_num & 0xF0) >> 4);
|
||||
*(rev + 3) = system_to_hex(rev_num & 0x0F);
|
||||
*(rev + 4) = '\0';
|
||||
|
||||
return rev;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user