[coreboot-gerrit] New patch to review for coreboot: x86/smbios: Return index 0 for empty strings
Ben Gardner (gardner.ben@gmail.com)
gerrit at coreboot.org
Wed Dec 9 18:30:13 CET 2015
Ben Gardner (gardner.ben at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12697
-gerrit
commit 4d94e7a758eb727febec953ffc57dc0f3c62e276
Author: Ben Gardner <gardner.ben at gmail.com>
Date: Wed Dec 9 11:24:35 2015 -0600
x86/smbios: Return index 0 for empty strings
Section 6.1.3 (Text Strings) of the SMBIOS specification states:
If a string field references no string, a null (0) is placed in that
string field.
Change smbios_add_string() to do that.
Change-Id: I9c28cb89dcfe2c8ef2366c23ee6203e15b7c2513
Signed-off-by: Ben Gardner <gardner.ben at gmail.com>
---
src/arch/x86/smbios.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 03d95e0..305ba40 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -46,6 +46,13 @@ int smbios_add_string(char *start, const char *str)
int i = 1;
char *p = start;
+ /*
+ * Return 0 as required for empty strings.
+ * See Section 6.1.3 "Text Strings" of the SMBIOS specification.
+ */
+ if (*str == '\0')
+ return 0;
+
for(;;) {
if (!*p) {
strcpy(p, str);
More information about the coreboot-gerrit
mailing list