Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/75132 )
Change subject: mb/prodrive/atlas: Make default SN/PN not empty ......................................................................
mb/prodrive/atlas: Make default SN/PN not empty
If reading the serial/part number fails, returning an empty string is very confusing. Instead, return "INVALID" to make problems obvious.
Change-Id: I3c174ca76d51b44456c7b68f4fcffb4c8f9379be Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/mainboard/prodrive/atlas/vpd.c 1 file changed, 20 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/75132/1
diff --git a/src/mainboard/prodrive/atlas/vpd.c b/src/mainboard/prodrive/atlas/vpd.c index 75d1caf..ba249a9 100644 --- a/src/mainboard/prodrive/atlas/vpd.c +++ b/src/mainboard/prodrive/atlas/vpd.c @@ -8,6 +8,11 @@ #include "mainboard.h" #include "vpd.h"
+static void write_invalid_str(char *dest, size_t length) +{ + snprintf(dest, length, "%s", "INVALID"); +} + const struct emi_eeprom_vpd *get_emi_eeprom_vpd(void) { static union { @@ -48,8 +53,8 @@ case 0: memset(vpd.raw, 0, sizeof(vpd.raw)); vpd.layout.header.magic = VPD_MAGIC; - vpd.layout.serial_number[0] = '\0'; - vpd.layout.part_number[0] = '\0'; + write_invalid_str(vpd.layout.serial_number, sizeof(vpd.layout.serial_number)); + write_invalid_str(vpd.layout.part_number, sizeof(vpd.layout.part_number)); vpd.layout.profile = ATLAS_PROF_UNPROGRAMMED; __fallthrough; default: