All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@wdc.com>
To: Oleh Kravchenko <oleg@kaa.org.ua>,
	Chris Ball <chrisball@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"patchwork-bot@kernel.org" <patchwork-bot@kernel.org>
Cc: Bean Huo <beanhuo@micron.com>
Subject: RE: [PATCH v4] mmc-utils: Use printf() to extract and print fw version
Date: Tue, 30 Nov 2021 07:42:42 +0000	[thread overview]
Message-ID: <DM6PR04MB657569E423F95B4151E56C80FC679@DM6PR04MB6575.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20211129154826.23595-1-oleg@kaa.org.ua>

Hi,
> 
> This patch also fixes a compile error with a newer version of GCC:
> error: '__builtin_strncpy' output may be truncated copying 8 bytes from a
> string of length 511 [-Werror=stringop-truncation]
You are reverting commit 0eea71e4f2 (mmc-utils: Fix for Firmware Version string printing).
Please use git revert and add an explanation in your commit log.

You might also would like to take a look at the correspondence concerning a different approach to the same issue here - https://lore.kernel.org/lkml/20211114204331.39555-2-huobean@gmail.com/

Thanks,
Avri

> 
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> Reviewed-by: Bean Huo <beanhuo@micron.com>
> ---
>  mmc_cmds.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> PATCH v4
> Update commit message.
> 
> diff --git a/mmc_cmds.c b/mmc_cmds.c
> index 73bd32a..e07ec94 100644
> --- a/mmc_cmds.c
> +++ b/mmc_cmds.c
> @@ -1392,7 +1392,6 @@ int do_read_extcsd(int nargs, char **argv)
>         __u32 regl;
>         int fd, ret;
>         char *device;
> -       char lbuf[10];
>         const char *str;
> 
>         if (nargs != 2) {
> @@ -1834,9 +1833,7 @@ int do_read_extcsd(int nargs, char **argv)
>         }
> 
>         if (ext_csd_rev >= 7) {
> -                memset(lbuf, 0, sizeof(lbuf));
> -               strncpy(lbuf, (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION], 8);
> -               printf("eMMC Firmware Version: %s\n", lbuf);
> +               printf("eMMC Firmware Version: %.8s\n",
> + (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION]);
>                 printf("eMMC Life Time Estimation A
> [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x%02x\n",
>                         ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]);
>                 printf("eMMC Life Time Estimation B
> [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x%02x\n",
> --
> 2.32.0


  reply	other threads:[~2021-11-30  7:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 10:51 [PATCH] Fix strncpy() usage Oleh Kravchenko
2021-11-25 13:30 ` Ulf Hansson
2021-11-26 14:47 ` [PATCH v2] Replace strncpy() usage by printf() Oleh Kravchenko
2021-11-29 12:03   ` Ulf Hansson
2021-11-29 12:41 ` [PATCH v3] Use printf() to extract and print fw version Oleh Kravchenko
2021-11-29 15:05   ` [EXT] " Bean Huo (beanhuo)
2021-11-29 15:43     ` Oleh Kravchenko
2021-11-29 15:44 ` [PATCH v3] mmc-utils: " Oleh Kravchenko
2021-11-29 15:48 ` [PATCH v4] " Oleh Kravchenko
2021-11-30  7:42   ` Avri Altman [this message]
2021-11-30 12:07     ` Oleh Kravchenko
2021-11-30 12:14       ` Ulf Hansson
2021-11-30 14:25         ` Oleh Kravchenko
2021-11-30 14:27 ` [PATCH v5] " Oleh Kravchenko
2021-12-02 14:26   ` Ulf Hansson

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=DM6PR04MB657569E423F95B4151E56C80FC679@DM6PR04MB6575.namprd04.prod.outlook.com \
    --to=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=chrisball@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=oleg@kaa.org.ua \
    --cc=patchwork-bot@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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.