]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mtd: lpddr_cmds: Add literal suffix
authorDenis Arefev <arefev@swemel.ru>
Thu, 24 Aug 2023 13:02:15 +0000 (16:02 +0300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 11 Sep 2023 15:50:42 +0000 (17:50 +0200)
The value of an arithmetic expression
1 << lpddr->qinfo->DevSizeShift is subject to overflow
due to a failure to cast operands to a larger data
type before performing arithmetic

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230824130215.10396-1-arefev@swemel.ru
drivers/mtd/lpddr/lpddr_cmds.c

index 3c3939bc2dadc627dba29fbf1085bcdd76068e78..14e36ae71958f9b3436e1b868a9843981304c947 100644 (file)
@@ -61,7 +61,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
                mtd->_point = lpddr_point;
                mtd->_unpoint = lpddr_unpoint;
        }
-       mtd->size = 1 << lpddr->qinfo->DevSizeShift;
+       mtd->size = 1ULL << lpddr->qinfo->DevSizeShift;
        mtd->erasesize = 1 << lpddr->qinfo->UniformBlockSizeShift;
        mtd->writesize = 1 << lpddr->qinfo->BufSizeShift;