From 2119a969c64232f2989f73d073a477cb1e2f6b71 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:00:55 +0000 Subject: net: phy: nxp-c45-tja11xx: fix unsigned long multiplication overflow (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-108-net-phy-nxp-c45-tja11xx-fix-unsigned-long-mult.patch b/patches.kernel.org/6.2.12-108-net-phy-nxp-c45-tja11xx-fix-unsigned-long-mult.patch new file mode 100644 index 0000000..cc5d88d --- /dev/null +++ b/patches.kernel.org/6.2.12-108-net-phy-nxp-c45-tja11xx-fix-unsigned-long-mult.patch @@ -0,0 +1,45 @@ +From: "Radu Pirea (OSS)" +Date: Thu, 6 Apr 2023 12:59:53 +0300 +Subject: [PATCH] net: phy: nxp-c45-tja11xx: fix unsigned long multiplication + overflow +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: bdaaecc127d471c422ee9e994978617c8aa79e1e + +commit bdaaecc127d471c422ee9e994978617c8aa79e1e upstream. + +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: # 5.15+ +Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support") +Signed-off-by: Radu Pirea (OSS) +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20230406095953.75622-1-radu-nicolae.pirea@oss.nxp.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + drivers/net/phy/nxp-c45-tja11xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c +index 27738d1a..029875a5 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) +-- +2.35.3 + diff --git a/series.conf b/series.conf index d3b315b..1a7e0ec 100644 --- a/series.conf +++ b/series.conf @@ -2335,6 +2335,7 @@ patches.kernel.org/6.2.12-105-HID-intel-ish-hid-Fix-kernel-panic-during-warm.patch patches.kernel.org/6.2.12-106-net-sfp-initialize-sfp-i2c_block_size-at-sfp-a.patch patches.kernel.org/6.2.12-107-net-phy-nxp-c45-tja11xx-add-remove-callback.patch + patches.kernel.org/6.2.12-108-net-phy-nxp-c45-tja11xx-fix-unsigned-long-mult.patch ######################################################## # Build fixes that apply to the vanilla kernel too.