From: Michal Simek <michal.simek@amd.com>
To: "Jae Hyun Yoo" <quic_jaehyoo@quicinc.com>,
"Ovidiu Panait" <ovidiu.panait@windriver.com>,
"Simon Glass" <sjg@chromium.org>,
"Mario Six" <mario.six@gdsys.cc>,
"Masahisa Kojima" <masahisa.kojima@linaro.org>,
"Pali Rohár" <pali@kernel.org>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Ashok Reddy Soma" <ashok.reddy.soma@xilinx.com>,
"Thomas Huth" <thuth@redhat.com>,
"Huang Jianan" <jnhuang95@gmail.com>,
"Chris Morgan" <macromorgan@hotmail.com>,
"Roland Gaudig" <roland.gaudig@weidmueller.com>,
"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
"Alexandru Gagniuc" <mr.nuke.me@gmail.com>
Cc: "Jamie Iles" <quic_jiles@quicinc.com>,
"Graeme Gregory" <quic_ggregory@quicinc.com>,
"Cédric Le Goater" <clg@kaod.org>,
u-boot@lists.denx.de
Subject: Re: [PATCH v4 3/6] cmd: fru: fix a sandbox segfault issue
Date: Wed, 21 Sep 2022 15:07:50 +0200 [thread overview]
Message-ID: <35633d86-41e8-563a-4cc9-ebd9ad02f7e1@amd.com> (raw)
In-Reply-To: <20220825164245.1606958-4-quic_jaehyoo@quicinc.com>
On 8/25/22 18:42, Jae Hyun Yoo wrote:
> This command doesn't work with sandbox because direct memory access
> causes a segfault error. Fix it up using map_sysmem().
>
> Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> Changes from v3:
> * None.
>
> Changes from v2:
> * Added a 'Reviewed-by' tag. (Simon)
>
> Changes from v1:
> * Newly added in v2.
>
> board/xilinx/common/board.c | 2 +-
> cmd/fru.c | 19 ++++++++++++++++---
> include/fru.h | 4 ++--
> lib/fru_ops.c | 17 ++++++++---------
> 4 files changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index e58b11d7f757..3292083c5250 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -241,7 +241,7 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
> goto end;
> }
>
> - fru_capture((unsigned long)fru_content);
> + fru_capture(fru_content);
> if (gd->flags & GD_FLG_RELOC || (_DEBUG && CONFIG_IS_ENABLED(DTB_RESELECT))) {
> printf("Xilinx I2C FRU format at %s:\n", name);
> ret = fru_display(0);
> diff --git a/cmd/fru.c b/cmd/fru.c
> index 2ec5012af5ac..b2cadbec9780 100644
> --- a/cmd/fru.c
> +++ b/cmd/fru.c
> @@ -9,12 +9,15 @@
> #include <fdtdec.h>
> #include <fru.h>
> #include <malloc.h>
> +#include <mapmem.h>
>
> static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> {
> unsigned long addr;
> + const void *buf;
> char *endp;
> + int ret;
>
> if (argc < cmdtp->maxargs)
> return CMD_RET_USAGE;
> @@ -23,7 +26,11 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
> if (*argv[1] == 0 || *endp != 0)
> return -1;
>
> - return fru_capture(addr);
> + buf = map_sysmem(addr, 0);
> + ret = fru_capture(buf);
> + unmap_sysmem(buf);
> +
> + return ret;
> }
>
> static int do_fru_display(struct cmd_tbl *cmdtp, int flag, int argc,
> @@ -37,13 +44,19 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> {
> unsigned long addr;
> + const void *buf;
> + int ret;
>
> if (argc < cmdtp->maxargs)
> return CMD_RET_USAGE;
>
> - addr = hextoul(argv[2], NULL);
> + addr = hextoul(argv[3], NULL);
What's the reason for changing arguments here? Wasn't origin version correct?
Thanks,
Michal
next prev parent reply other threads:[~2022-09-21 13:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 16:42 [PATCH v4 0/6] cmd/fru: move FRU handling support to common region Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 1/6] xilinx: common: refactor FRU handling support Jae Hyun Yoo
2022-09-21 13:40 ` Michal Simek
2022-09-22 6:39 ` Jae Hyun Yoo
2022-09-22 7:29 ` Michal Simek
2022-09-22 16:22 ` Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 2/6] cmd: fru: move FRU handling support to common region Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 3/6] cmd: fru: fix a sandbox segfault issue Jae Hyun Yoo
2022-09-21 13:07 ` Michal Simek [this message]
2022-09-22 6:39 ` Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 4/6] cmd: fru: add product info area parsing support Jae Hyun Yoo
2022-09-21 13:52 ` Michal Simek
2022-09-22 6:39 ` Jae Hyun Yoo
2022-09-22 7:19 ` Michal Simek
2022-09-22 16:15 ` Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 5/6] doc: fru: add documentation for the fru command and APIs Jae Hyun Yoo
2022-09-21 13:54 ` Michal Simek
2022-09-22 6:40 ` Jae Hyun Yoo
2022-08-25 16:42 ` [PATCH v4 6/6] test: cmd: fru: add unit test for the fru command Jae Hyun Yoo
2022-09-15 14:01 ` [PATCH v4 0/6] cmd/fru: move FRU handling support to common region Jae Hyun Yoo
2022-09-15 14:38 ` Michal Simek
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=35633d86-41e8-563a-4cc9-ebd9ad02f7e1@amd.com \
--to=michal.simek@amd.com \
--cc=ashok.reddy.soma@xilinx.com \
--cc=clg@kaod.org \
--cc=jnhuang95@gmail.com \
--cc=macromorgan@hotmail.com \
--cc=mario.six@gdsys.cc \
--cc=masahisa.kojima@linaro.org \
--cc=mr.nuke.me@gmail.com \
--cc=ovidiu.panait@windriver.com \
--cc=pali@kernel.org \
--cc=patrick.delaunay@foss.st.com \
--cc=quic_ggregory@quicinc.com \
--cc=quic_jaehyoo@quicinc.com \
--cc=quic_jiles@quicinc.com \
--cc=roland.gaudig@weidmueller.com \
--cc=sjg@chromium.org \
--cc=thuth@redhat.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox