linux/drivers/mtd
Miquel Raynal 89f706dbd5 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.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-02 09:20:41 +01:00
..
chips mtd: cfi_cmdset_0020: Mark expected switch fall-throughs 2018-11-09 20:40:11 +01:00
devices mtd: block2mtd: mark expected switch fall-throughs 2018-11-09 20:32:43 +01:00
lpddr mtd: lpddr: use mtd_device_register() 2018-07-24 07:50:22 +02:00
maps mtd: maps: Get rid of the latch-addr-flash driver 2018-11-06 23:33:06 +01:00
nand SPI NOR changes: 2018-10-23 01:09:22 +01:00
parsers mtd: partitions: Add OF support to RedBoot partitions 2018-11-12 11:51:02 +01:00
spi-nor mtd: spi-nor: fsl-quadspi: fix read error for flash size larger than 16MB 2018-10-12 11:48:19 +02:00
tests mtd: rawnand: Allow selection of ECC byte ordering at runtime 2018-10-03 11:12:25 +02:00
ubi ubi: Mark expected switch fall-throughs 2018-10-23 13:46:48 +02:00
Kconfig mtd: Move Redboot partition parser 2018-11-12 11:44:13 +01:00
Makefile mtd: Move Redboot partition parser 2018-11-12 11:44:13 +01:00
afs.c
ar7part.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
bcm47xxpart.c
bcm63xxpart.c
cmdlinepart.c
ftl.c
inftlcore.c
inftlmount.c
mtd_blkdevs.c mtd_blkdevs: convert to blk-mq 2018-10-16 08:09:58 -06:00
mtdblock.c
mtdblock_ro.c
mtdchar.c mtdchar: fix overflows in adjustment of `count` 2018-07-18 16:46:38 +02:00
mtdconcat.c
mtdcore.c mtd: fix Coverity integer handling issue 2018-12-02 09:20:41 +01:00
mtdcore.h
mtdoops.c
mtdpart.c mtd: partitions: fix unbalanced of_node_get/put() 2018-09-17 16:23:12 +02:00
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c mtd: nftl: clean up indentation, remove extraneous tabs 2018-12-02 09:20:36 +01:00
ofpart.c
rfd_ftl.c
sm_ftl.c mtd: rawnand: Allow selection of ECC byte ordering at runtime 2018-10-03 11:12:25 +02:00
sm_ftl.h
ssfdc.c