From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Daniel Golle <daniel@makrotopia.org>,
Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mtd: ubi: fix NVMEM over UBI volumes on 32-bit systems
Date: Wed, 28 Feb 2024 09:45:13 +0800 [thread overview]
Message-ID: <8ae44e8e-fc3d-28bd-5d1e-e900ce53529f@huawei.com> (raw)
In-Reply-To: <31a20aead3419209991bf01aaeaefe07ab94d23a.1709081052.git.daniel@makrotopia.org>
在 2024/2/28 8:46, Daniel Golle 写道:
> A compiler warning related to sizeof(int) != 8 when calling do_div()
> is triggered when building on 32-bit platforms.
> Address this by using integer types having a well-defined size.
>
> Fixes: 3ce485803da1 ("mtd: ubi: provide NVMEM layer over UBI volumes")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> v2: use size_t for 'bytes_left' variable to match parameter type
>
> drivers/mtd/ubi/nvmem.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/nvmem.c b/drivers/mtd/ubi/nvmem.c
> index b7a93c495d172..e68b8589c4279 100644
> --- a/drivers/mtd/ubi/nvmem.c
> +++ b/drivers/mtd/ubi/nvmem.c
> @@ -23,9 +23,12 @@ struct ubi_nvmem {
> static int ubi_nvmem_reg_read(void *priv, unsigned int from,
> void *val, size_t bytes)
> {
> - int err = 0, lnum = from, offs, bytes_left = bytes, to_read;
> struct ubi_nvmem *unv = priv;
> struct ubi_volume_desc *desc;
> + size_t bytes_left = bytes;
> + uint32_t offs, to_read;
There still exist a type truncation assignment 'to_read = bytes_left'
below, although it's safe in logic.
> + uint64_t lnum = from;
> + int err = 0;
>
> desc = ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY);
> if (IS_ERR(desc))
>
next prev parent reply other threads:[~2024-02-28 1:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 0:46 Daniel Golle
2024-02-28 1:45 ` Zhihao Cheng [this message]
2024-03-07 9:17 ` Dan Carpenter
2024-03-07 11:42 ` Daniel Golle
2024-03-07 12:03 ` Dan Carpenter
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=8ae44e8e-fc3d-28bd-5d1e-e900ce53529f@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=daniel@makrotopia.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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
all inboxes | Powered by JetHome®