net: fman: memac: Uninitialized variable on error path
PATCH 1/1 net: fman: memac: Uninitialized variable on error path
The "fixed_link" is only allocated sometimes but it's freed unconditionally in the error handling. Set it to NULL so we don't free uninitialized data.
--- drivers/net/ethernet/freescale/fman/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fman/mac.c +1 -1
@@ -389,7 +389,7 @@ static int memac_initialization(struct mac_device *mac_dev, {int err;struct fman_mac_params params; -struct fixed_phy_status *fixed_link; +struct fixed_phy_status *fixed_link =NULL ; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address;
Signature · 1 line
2.35.1
Quoted 16 lines · Dan Carpenter
The "
fixed_link" is only allocated sometimes but it's freed unconditionally in the error handling. Set it to NULL so we don't free uninitialized data.Fixes 9ea4742a55ca ("net: fman: Configure fixed link in memac_initialization")Signed-off-by Dan Carpenter <[email protected]>--- drivers/net/ethernet/freescale/fman/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/fman/mac.c +0
-0
drivers/net/ethernet/freescale/fman/mac.c static int memac_initialization(struct mac_device *mac_dev, · line 395
Quoted 8 lines
drivers/net/ethernet/freescale/fman/mac.c +1
-1@@ -389,7 +389,7 @@ static int memac_initialization(struct mac_device *mac_dev, {int err;struct fman_mac_params params; -struct fixed_phy_status *fixed_link; +struct fixed_phy_status *fixed_link =NULL ; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address;
This is also fixed by [1]
--Sean
Sean Anderson
Reviewed-byQuoted 30 lines · Sean Anderson
Quoted 16 lines · Dan Carpenter
The "
fixed_link" is only allocated sometimes but it's freed unconditionally in the error handling. Set it to NULL so we don't free uninitialized data.Fixes 9ea4742a55ca ("net: fman: Configure fixed link in memac_initialization")Signed-off-by Dan Carpenter <[email protected]>--- drivers/net/ethernet/freescale/fman/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/fman/mac.c +0
-0drivers/net/ethernet/freescale/fman/mac.c static int memac_initialization(struct mac_device *mac_dev, · line 395
Quoted 8 lines
drivers/net/ethernet/freescale/fman/mac.c +1
-1@@ -389,7 +389,7 @@ static int memac_initialization(struct mac_device *mac_dev, {int err;struct fman_mac_params params; -struct fixed_phy_status *fixed_link; +struct fixed_phy_status *fixed_link =NULL ; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address;This is also fixed by [1]
Quoted 4 lines
--Sean
Whoops, I didn't read this correctly.
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 25 Aug 2022 16:17:19 +0300 you wrote:
The "
fixed_link" is only allocated sometimes but it's freed unconditionally in the error handling. Set it to NULL so we don't free uninitialized data.Fixes 9ea4742a55ca ("net: fman: Configure fixed link in memac_initialization")Signed-off-by Dan Carpenter <[email protected]>[...]
Here is the summary with links:
- [net-next] net: fman: memac: Uninitialized variable on error path
https://git.kernel.org/netdev/net-next/c/931d0a8b201a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html