summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorinel Iordache <florinel.iordache@nxp.com>2020-08-03 10:07:30 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-19 08:16:20 +0200
commite9b3249a3df692cce579c533b40147def384ca7a (patch)
tree1d5fdc6c9e3510ed9f2a90ff65bacde48e64e604
parent8c68da19fd022df4c48c08a0cf7dc5d36ade793b (diff)
downloadlinux-stable-e9b3249a3df692cce579c533b40147def384ca7a.tar.gz
linux-stable-e9b3249a3df692cce579c533b40147def384ca7a.tar.bz2
linux-stable-e9b3249a3df692cce579c533b40147def384ca7a.zip
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>
-rw-r--r--drivers/net/ethernet/freescale/fman/fman.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c
index 4c2fa13a7dd7..c8e434c8ab98 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -1396,8 +1396,7 @@ static void enable_time_stamp(struct fman *fman)
{
struct fman_fpm_regs __iomem *fpm_rg = fman->fpm_regs;
u16 fm_clk_freq = fman->state->fm_clk_freq;
- u32 tmp, intgr, ts_freq;
- u64 frac;
+ u32 tmp, intgr, ts_freq, frac;
ts_freq = (u32)(1 << fman->state->count1_micro_bit);
/* configure timestamp so that bit 8 will count 1 microsecond