From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miquel Raynal Date: Mon, 8 Apr 2019 15:42:06 +0200 Subject: [U-Boot] [PATCH 2/2] mtd: fix Coverity integer handling issue In-Reply-To: <20190408115216.GB4664@bill-the-cat> References: <20181118201147.11257-1-miquel.raynal@bootlin.com> <20181118201147.11257-2-miquel.raynal@bootlin.com> <20181118211347.47efa9b0@xps13> <20190408114359.29da1f39@xps13> <20190408115216.GB4664@bill-the-cat> Message-ID: <20190408154206.39435899@xps13> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi Tom, Tom Rini wrote on Mon, 8 Apr 2019 07:52:16 -0400: > On Mon, Apr 08, 2019 at 11:43:59AM +0200, Miquel Raynal wrote: > > Hello, > >=20 > > Miquel Raynal wrote on Sun, 18 Nov 2018 > > 21:13:47 +0100: > > =20 > > > Hello, > > >=20 > > > Miquel Raynal wrote on Sun, 18 Nov 2018 > > > 21:11:47 +0100: > > > =20 > > > > A Coverity robot reported an integer handling issue > > > > (OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression: > > > >=20 > > > > (mtd_div_by_ws(mtd->size, mtd) - mtd_div_by_ws(offs, mtd)) * > > > > mtd_oobavail(mtd, ops) > > > >=20 > > > > While such overflow will certainly never happen due to the numbers > > > > handled, it is cleaner to fix this operation anyway. > > > >=20 > > > > The problem is that all the maths include 32-bit quantities, while = the > > > > result is stored in an explicit 64-bit value. > > > >=20 > > > > 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 wi= ll > > > > clarify a bit the situation. Then, do an explicit cast to fix Cover= ity > > > > warning. > > > >=20 > > > > Addresses-Coverity-ID: 184180 ("Integer handling issues") > > > > Signed-off-by: Miquel Raynal > > > > --- =20 > > >=20 > > > I forgot to add the link to the corresponding Travis-CI job: > > > https://travis-ci.org/miquelraynal/u-boot/builds/456679982 =20 > >=20 > > Gentle ping on this series (patch 1 & 2). They do apply cleanly on > > current master. > >=20 > > Tom, shall I expect you to take it or is it Jagan's mission? =20 >=20 > My current feeling is this goes via Jagan's tree and I wasn't expecting > them in for this release. Thanks! >=20 No problem, I know we are late in the merge process, these are just Coverity fixes, they are not urgent, I just am cleaning my branches and I discover many patches which I thought were merged but actually only exist in my local tree, which is sad :) Thanks, Miqu=C3=A8l -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: