fsl/fman: use 32-bit unsigned integer
authorFlorinel Iordache <florinel.iordache@nxp.com>
Mon, 3 Aug 2020 07:07:30 +0000 (10:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:07 +0000 (08:24 +0200)
commit95582c0f11c47202e4f78a980b1db8b539be8ed8
tree2c335bdbb453a33fc2c679aa58397ee2a9452eb8
parenta4a413dc683e24f8deca9b1a782f98f4e1165e02
fsl/fman: use 32-bit unsigned integer

[ Upstream commit 99f47abd9f7bf6e365820d355dc98f6955a562df ]

Potentially overflowing expression (ts_freq << 16 and intgr << 16)
declared as type u32 (32-bit unsigned) is evaluated using 32-bit
arithmetic and then used in a context that expects an expression of
type u64 (64-bit unsigned) which ultimately is used as 16-bit
unsigned by typecasting to u16. Fixed by using an unsigned 32-bit
integer since the value is truncated anyway in the end.

Fixes: 414fd46e7762 ("fsl/fman: Add FMan support")
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/fman/fman.c