summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorRadu Pirea (OSS) <radu-nicolae.pirea@oss.nxp.com>2023-04-06 12:59:53 +0300
committerJakub Kicinski <kuba@kernel.org>2023-04-08 05:48:34 +0300
commitbdaaecc127d471c422ee9e994978617c8aa79e1e (patch)
treeb0a3e0aa7815e37aa6ed7ba6eee512c7a70cd0fe /drivers/net
parent066b86787fa3d97b7aefb5ac0a99a22dad2d15f8 (diff)
downloadlinux-bdaaecc127d471c422ee9e994978617c8aa79e1e.tar.xz
net: phy: nxp-c45-tja11xx: fix unsigned long multiplication overflow
Any multiplication between GENMASK(31, 0) and a number bigger than 1 will be truncated because of the overflow, if the size of unsigned long is 32 bits. Replaced GENMASK with GENMASK_ULL to make sure that multiplication will be between 64 bits values. Cc: <stable@vger.kernel.org> # 5.15+ Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support") Signed-off-by: Radu Pirea (OSS) <radu-nicolae.pirea@oss.nxp.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20230406095953.75622-1-radu-nicolae.pirea@oss.nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/nxp-c45-tja11xx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 5813b07242ce..1b7d6941b0f3 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -191,7 +191,7 @@
#define MAX_ID_PS 2260U
#define DEFAULT_ID_PS 2000U
-#define PPM_TO_SUBNS_INC(ppb) div_u64(GENMASK(31, 0) * (ppb) * \
+#define PPM_TO_SUBNS_INC(ppb) div_u64(GENMASK_ULL(31, 0) * (ppb) * \
PTP_CLK_PERIOD_100BT1, NSEC_PER_SEC)
#define NXP_C45_SKB_CB(skb) ((struct nxp_c45_skb_cb *)(skb)->cb)