From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Biju Das <biju.das@bp.renesas.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Simon Horman <horms@verge.net.au>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Chris Paterson <Chris.Paterson2@renesas.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Fabrizio Castro <fabrizio.castro@bp.renesas.com>,
linux-rtc@vger.kernel.org,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v3] nvmem: check invalid number of bytes in nvmem_{read,write}()
Date: Tue, 11 Dec 2018 12:06:17 +0100 [thread overview]
Message-ID: <CAMuHMdXraSz4dtBi0hzZ-w_goKiy_fObE0S-Vi6xQhSxHNnhqQ@mail.gmail.com> (raw)
In-Reply-To: <OSBPR01MB210338DE328981500C6992F8B8A60@OSBPR01MB2103.jpnprd01.prod.outlook.com>
Hi Biju,
On Tue, Dec 11, 2018 at 11:55 AM Biju Das <biju.das@bp.renesas.com> wrote:
> > Subject: Re: [PATCH v3] nvmem: check invalid number of bytes in
> > nvmem_{read,write}()
> >
> > After applying this patch I get below errors with W=1 C=1
> >
> > On 11/12/18 09:24, Biju Das wrote:
> > > +if (unlikely(check_add_overflow(bytes, offset, &new_bytes)))
> > > +return -EOVERFLOW;
> > > drivers/nvmem/core.c:82:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:82:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:113:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:113:13: error: incompatible types in comparison
> > expression (different type sizes)
>
> I was trying with arm32 toolchain and compiler happy. Now tried with Arm64 toolchain, it provides a warning and the below typecast fixed the issue.
> if (unlikely(check_add_overflow(bytes, (size_t)offset, &new_bytes)))
>
> Does typecasting to (size_t) fixed the issue in your environment? Please let me know.
That's a side-effect of offset not being loff_t...
I think that should be fixed first, else you will forget about
removing the cast later
("casts are evil").
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2018-12-11 11:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 9:24 [PATCH v3] nvmem: check invalid number of bytes in nvmem_{read,write}() Biju Das
2018-12-11 9:55 ` Srinivas Kandagatla
2018-12-11 10:54 ` Biju Das
2018-12-11 11:06 ` Geert Uytterhoeven [this message]
2018-12-11 11:10 ` Srinivas Kandagatla
2018-12-11 11:27 ` Geert Uytterhoeven
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=CAMuHMdXraSz4dtBi0hzZ-w_goKiy_fObE0S-Vi6xQhSxHNnhqQ@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=Chris.Paterson2@renesas.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=biju.das@bp.renesas.com \
--cc=fabrizio.castro@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=horms@verge.net.au \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=srinivas.kandagatla@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).