From patchwork Wed Mar 17 11:30:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 1454614 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=GeatBVD9; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0nzV2PW8z9sTD for ; Wed, 17 Mar 2021 22:31:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7376782759; Wed, 17 Mar 2021 12:31:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="GeatBVD9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E52C82777; Wed, 17 Mar 2021 12:30:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9608782714 for ; Wed, 17 Mar 2021 12:30:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matthias.bgg@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 795CE64F2B; Wed, 17 Mar 2021 11:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615980653; bh=Cd4tYQ687l4jwsSAGuiUBbunCXKTT4DOGHSxawWruyI=; h=From:To:Cc:Subject:Date:From; b=GeatBVD9WbNClTcDNSPxrLmtNhp8Mz1V4tnHUUYQCbtd5muoigR79n7h43aXvmiKv bm85+BPBwJuMYQji/13WnO9CqUESMcixJbZB8T48V0EWFnQIMAjrij/IaDhBsL0gyG tSBaBlIaZ+3tS+t3YJ1MtTZqRjGZXxKWVeXFCYuGSYW3s9sOCQ5WeTYofLyb23GPGp 3ayVyCqu9DTMspF2RE27hIzlsivX+VkvcVQ86q5eRXdN/0GivYPb+lekEU0sD48F2/ CO45TbOMEYZJ5JVdoKealr4o+WdnyRyTdz/ji53oFaKt3pjwg4Lefa95JI8mAFhaDi cvc6bLilQLy3w== From: matthias.bgg@kernel.org To: sjg@chromium.org Cc: xypron.glpk@gmx.de, bmeng.cn@gmail.com, u-boot@lists.denx.de, Matthias Brugger , Christian Gmeiner Subject: [PATCH] smbios: Fix table when no string is present Date: Wed, 17 Mar 2021 12:30:45 +0100 Message-Id: <20210317113045.8074-1-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Matthias Brugger 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 --- 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; }