From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
Bin Meng <bmeng.cn@gmail.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH v2 2/4] cmd: provide command to display SMBIOS information
Date: Thu, 18 Jan 2024 14:39:10 +0200 [thread overview]
Message-ID: <Zakb7ozkAU994FBj@hera> (raw)
In-Reply-To: <20240117153347.85074-2-heinrich.schuchardt@canonical.com>
Hi Heinrich,
A few nits below
On Wed, Jan 17, 2024 at 04:33:45PM +0100, Heinrich Schuchardt wrote:
> U-Boot can either generated an SMBIOS table or copy it from a prior boot
> stage, e.g. QEMU.
>
> Provide a command to display the SMBIOS information.
>
> Currently only type 1 and 2 are translated to human readable text.
> Other types may be added later. Currently only a hexdump and the list of
> strings is provided for these.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> v2:
[...]
> email address updated
> +static struct smbios_header *next_table(struct smbios_header *table)
> +{
> + const char *str;
> +
> + if (table->type == SMBIOS_END_OF_TABLE)
> + return NULL;
> +
> + str = smbios_get_string(table, 0);
> + return (struct smbios_header *)(++str);
That can lead to unaligned access when we dereference that pointer, do we
care?
> +}
> +
> +static void smbios_print_generic(struct smbios_header *table)
> +{
> + char *str = (char *)table + table->length;
> +
Do we want the header below printed if there are no strings?
IOW can we exit early if (!*str) ?
> + if (CONFIG_IS_ENABLED(HEXDUMP)) {
> + printf("Header and Data:\n");
> + print_hex_dump("\t", DUMP_PREFIX_OFFSET, 16, 1,
> + table, table->length, false);
> + }
> + if (*str) {
> + printf("Strings:\n");
> + for (int index = 1; *str; ++index) {
> + printf("\tString %u: %s\n", index, str);
> + str += strlen(str) + 1;
> + }
> + }
> +}
> +
> +void smbios_print_str(const char *label, void *table, u8 index)
> +{
> + printf("\t%s: %s\n", label, smbios_get_string(table, index));
> +}
> +
Other than that, LGTM
Thanks
/Ilias
next prev parent reply other threads:[~2024-01-18 12:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 15:33 [PATCH v2 1/4] smbios: type2: contained object handles Heinrich Schuchardt
2024-01-17 15:33 ` [PATCH v2 2/4] cmd: provide command to display SMBIOS information Heinrich Schuchardt
2024-01-18 12:39 ` Ilias Apalodimas [this message]
2024-01-18 12:54 ` Heinrich Schuchardt
2024-01-18 12:58 ` Ilias Apalodimas
2024-01-24 21:16 ` Tom Rini
2024-01-24 23:24 ` Heinrich Schuchardt
2024-01-25 0:17 ` Tom Rini
2024-01-25 10:45 ` Peter Robinson
2024-01-17 15:33 ` [PATCH v2 3/4] doc: man-page for smbios command Heinrich Schuchardt
2024-01-17 15:33 ` [PATCH v2 4/4] test: unit test " Heinrich Schuchardt
2024-01-18 11:51 ` Ilias Apalodimas
2024-01-18 12:33 ` Heinrich Schuchardt
2024-01-18 12:35 ` Ilias Apalodimas
2024-01-17 16:10 ` [PATCH v2 0/4] cmd: provide command to display SMBIOS information Heinrich Schuchardt
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=Zakb7ozkAU994FBj@hera \
--to=ilias.apalodimas@linaro.org \
--cc=bmeng.cn@gmail.com \
--cc=heinrich.schuchardt@canonical.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.