Message ID | 20230824130215.10396-1-arefev@swemel.ru |
---|---|
State | Accepted |
Headers | show |
Series | mtd: lpddr_cmds: Added literal suffix | expand |
On Thu, 2023-08-24 at 13:02:15 UTC, Denis Arefev wrote: > 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> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks. Miquel
diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c index 3c3939bc2dad..14e36ae71958 100644 --- a/drivers/mtd/lpddr/lpddr_cmds.c +++ b/drivers/mtd/lpddr/lpddr_cmds.c @@ -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;
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> --- drivers/mtd/lpddr/lpddr_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)