[U-Boot] [PATCH 2/2] mtd: fix Coverity integer handling issue
Tom Rini
trini at konsulko.com
Mon Apr 8 11:52:16 UTC 2019
On Mon, Apr 08, 2019 at 11:43:59AM +0200, Miquel Raynal wrote:
> Hello,
>
> Miquel Raynal <miquel.raynal at bootlin.com> wrote on Sun, 18 Nov 2018
> 21:13:47 +0100:
>
> > Hello,
> >
> > Miquel Raynal <miquel.raynal at 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 at 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?
My current feeling is this goes via Jagan's tree and I wasn't expecting
them in for this release. Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190408/7570e674/attachment.sig>
More information about the U-Boot
mailing list