]> git.baikalelectronics.ru Git - kernel.git/commit
fs/ufs: avoid potential u32 multiplication overflow
authorColin Ian King <colin.king@canonical.com>
Wed, 12 Aug 2020 01:35:53 +0000 (18:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Aug 2020 17:58:01 +0000 (10:58 -0700)
commitc62758791dbd54f5956587eebbe2ee0184951c7f
treebf3516545621b2c7faec249367949a8fc6a8ea94
parentffcca434d174c1e3564a67f01616a8342c2a5ef9
fs/ufs: avoid potential u32 multiplication overflow

The 64 bit ino is being compared to the product of two u32 values,
however, the multiplication is being performed using a 32 bit multiply so
there is a potential of an overflow.  To be fully safe, cast uspi->s_ncg
to a u64 to ensure a 64 bit multiplication occurs to avoid any chance of
overflow.

Fixes: 66695f221af2 ("ufs: NFS support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Link: http://lkml.kernel.org/r/20200715170355.1081713-1-colin.king@canonical.com
Addresses-Coverity: ("Unintentional integer overflow")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ufs/super.c