Files
u-boot/drivers
Miquel Raynal 3f3aef4b9d mtd: fix Coverity integer handling issue
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>
2019-04-12 10:59:17 +05:30
..
2018-12-06 14:38:03 -08:00
2019-01-15 15:28:53 -05:00
2019-02-27 09:12:33 +08:00
2018-12-19 15:23:00 +01:00
2019-02-25 16:07:36 +01:00
2019-02-20 15:27:08 +08:00
2018-12-06 14:37:51 -08:00
2019-01-18 22:19:08 +05:30
2018-07-19 16:31:38 -04:00
2019-02-20 15:27:11 +08:00
2019-03-11 00:44:42 +01:00
2018-11-29 09:30:06 -07:00
2019-03-28 23:45:41 +01:00