summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-11-18 21:18:31 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-12-02 09:20:41 +0100
commit89f706dbd54faf2da1cb5bea9abc07b00c36ef69 (patch)
tree67612e275e1e586cc157656553e28d38c7bbf4d5 /drivers/mtd/mtdpart.c
parent4348433d8c0234f44adb6e12112e69343f50f0c5 (diff)
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>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
0 files changed, 0 insertions, 0 deletions