From: Miquel Raynal <miquel.raynal@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] mtd: fix Coverity integer handling issue
Date: Mon, 8 Apr 2019 11:43:59 +0200 [thread overview]
Message-ID: <20190408114359.29da1f39@xps13> (raw)
In-Reply-To: <20181118211347.47efa9b0@xps13>
Hello,
Miquel Raynal <miquel.raynal@bootlin.com> wrote on Sun, 18 Nov 2018
21:13:47 +0100:
> Hello,
>
> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Sun, 18 Nov 2018
> 21:11:47 +0100:
>
> > A Coverity robot reported an integer handling issue
> > (OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression:
> >
> > (mtd_div_by_ws(mtd->size, mtd) - mtd_div_by_ws(offs, mtd)) *
> > mtd_oobavail(mtd, ops)
> >
> > While such overflow will certainly never happen due to the numbers
> > handled, it is cleaner to fix this operation anyway.
> >
> > The problem is that all the maths include 32-bit quantities, while the
> > result is stored in an explicit 64-bit value.
> >
> > As maxooblen will just be compared with a size_t, let's change the
> > type of the variable to a size_t. This will not fix anything but will
> > clarify a bit the situation. Then, do an explicit cast to fix Coverity
> > warning.
> >
> > Addresses-Coverity-ID: 184180 ("Integer handling issues")
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
>
> I forgot to add the link to the corresponding Travis-CI job:
> https://travis-ci.org/miquelraynal/u-boot/builds/456679982
Gentle ping on this series (patch 1 & 2). They do apply cleanly on
current master.
Tom, shall I expect you to take it or is it Jagan's mission?
Thanks,
Miquèl
next prev parent reply other threads:[~2019-04-08 9:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 20:11 [U-Boot] [PATCH 1/2] mtd: fix mtd_oobavail() incoherent returned value Miquel Raynal
2018-11-18 20:11 ` [U-Boot] [PATCH 2/2] mtd: fix Coverity integer handling issue Miquel Raynal
2018-11-18 20:13 ` Miquel Raynal
2019-04-08 9:43 ` Miquel Raynal [this message]
2019-04-08 11:52 ` Tom Rini
2019-04-08 13:42 ` Miquel Raynal
2019-04-12 5:32 ` Jagan Teki
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=20190408114359.29da1f39@xps13 \
--to=miquel.raynal@bootlin.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.