[PATCH] smbios: Fix table when no string is present

matthias.bgg at kernel.org matthias.bgg at kernel.org
Wed Mar 17 12:30:45 CET 2021


From: Matthias Brugger <mbrugger at suse.com>

When no string is present in a table, next_ptr points to the same
location as eos. When calculating the string table length, we would only
reserve one \0. By spec a SMBIOS table has to end with two \0\0 when no
strings a present.

Signed-off-by: Matthias Brugger <mbrugger at suse.com>

---

 lib/smbios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/smbios.c b/lib/smbios.c
index 7d463c84a9..d21d37cdac 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -153,7 +153,7 @@ static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop)
 static void smbios_set_eos(struct smbios_ctx *ctx, char *eos)
 {
 	ctx->eos = eos;
-	ctx->next_ptr = eos;
+	ctx->next_ptr = eos + 1;
 	ctx->last_str = NULL;
 }
 
-- 
2.30.2



More information about the U-Boot mailing list