]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: diskonchip: Cast an operand to prevent potential overflow
authorZichen Xie <zichenxie0106@gmail.com>
Wed, 23 Oct 2024 21:13:10 +0000 (16:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:24:56 +0000 (13:24 +0100)
commit36a6523d097d338d2915c2b92a5d0232f5075efa
treec5a3e075ffed1ca47322d13a0364f9b0cff90cb0
parent9ad478986fd117e2d9ae057756644c1d1c6ddfae
mtd: diskonchip: Cast an operand to prevent potential overflow

commit 9b458e8be0d13e81ed03fffa23f8f9b528bbd786 upstream.

There may be a potential integer overflow issue in inftl_partscan().
parts[0].size is defined as "uint64_t"  while mtd->erasesize and
ip->firstUnit are defined as 32-bit unsigned integer. The result of
the calculation will be limited to 32 bits without correct casting.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/raw/diskonchip.c