All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@kernel.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Tom Rini <trini@konsulko.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Simon Glass <sjg@chromium.org>,
	Peter Robinson <pbrobinson@gmail.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH 4/7] smbios: string table always needs two terminating NUL bytes
Date: Wed, 31 Jan 2024 18:15:43 +0100	[thread overview]
Message-ID: <ZbqAP_PL9lidp5ru@ziggy.stardust> (raw)
In-Reply-To: <20240129210453.31070-5-heinrich.schuchardt@canonical.com>

On Mon, Jan 29, 2024 at 10:04:50PM +0100, Heinrich Schuchardt wrote:
> The string section of the different SMBIOS structures is always terminated
> by two NUL bytes even if there is no string at all. This is described in
> section 6.1.3 "Text string" of the SMBIOS 3.7.0 specification.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

I send the very same patch some years ago [1], unfortunately it got
somehow lost. Happy to see you trying to fix the same problem, so:
Reviewed-by: Matthias Brugger <mbrugger@suse.com>


[1] https://patchwork.ozlabs.org/project/uboot/patch/20210406090435.19357-1-matthias.bgg@kernel.org/ 

> ---
>  lib/smbios.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/smbios.c b/lib/smbios.c
> index 7bd9805fec0..81908e89610 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -311,6 +311,9 @@ int smbios_update_version(const char *version)
>   */
>  static int smbios_string_table_len(const struct smbios_ctx *ctx)
>  {
> +	/* If the structure contains no string it is followed by to NUL bytes */
> +	if (ctx->next_ptr == ctx->eos)
> +		return 2;
>  	/* Allow for the final \0 after all strings */
>  	return (ctx->next_ptr + 1) - ctx->eos;
>  }
> -- 
> 2.43.0

  reply	other threads:[~2024-01-31 17:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 21:04 [PATCH 0/7] smbios: missing strings, RISC-V processor ID Heinrich Schuchardt
2024-01-29 21:04 ` [PATCH 1/7] cmd: smbios: always use '0x%04x' for printing handles Heinrich Schuchardt
2024-01-29 21:04 ` [PATCH 2/7] cmd: smbios: add missing colon after UUID Heinrich Schuchardt
2024-02-01  8:40   ` Ilias Apalodimas
2024-01-29 21:04 ` [PATCH 3/7] cmd: smbios: replace missing string by 'Not Specified' Heinrich Schuchardt
2024-01-29 21:04 ` [PATCH 4/7] smbios: string table always needs two terminating NUL bytes Heinrich Schuchardt
2024-01-31 17:15   ` Matthias Brugger [this message]
2024-01-31 18:02     ` Heinrich Schuchardt
2024-02-01  8:38   ` Ilias Apalodimas
2024-01-29 21:04 ` [PATCH 5/7] smbios: if a string value is unknown, use string number 0 Heinrich Schuchardt
2024-02-01  8:41   ` Ilias Apalodimas
2024-01-29 21:04 ` [PATCH 6/7] smbios: provide type 4 RISC-V SMBIOS Processor ID Heinrich Schuchardt
2024-01-29 21:04 ` [PATCH 7/7] smbios: correctly fill chassis handle Heinrich Schuchardt
2024-02-01  8:42   ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbqAP_PL9lidp5ru@ziggy.stardust \
    --to=matthias.bgg@kernel.org \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=pbrobinson@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.