* [PATCH net-next] net: fman: memac: Uninitialized variable on error path
@ 2022-08-25 13:17 Dan Carpenter
2022-08-25 14:32 ` Sean Anderson
2022-08-27 2:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-08-25 13:17 UTC (permalink / raw)
To: Madalin Bucur, Sean Anderson
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Camelia Groza, netdev, kernel-janitors
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 <dan.carpenter@oracle.com>
---
drivers/net/ethernet/freescale/fman/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index c376b9bf657d..f9a3f85760fb 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -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;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: fman: memac: Uninitialized variable on error path
2022-08-25 13:17 [PATCH net-next] net: fman: memac: Uninitialized variable on error path Dan Carpenter
@ 2022-08-25 14:32 ` Sean Anderson
2022-08-25 14:36 ` Sean Anderson
2022-08-27 2:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Sean Anderson @ 2022-08-25 14:32 UTC (permalink / raw)
To: Dan Carpenter, Madalin Bucur
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Camelia Groza, netdev, kernel-janitors
On 8/25/22 9:17 AM, Dan Carpenter 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 <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/freescale/fman/mac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
> index c376b9bf657d..f9a3f85760fb 100644
> --- a/drivers/net/ethernet/freescale/fman/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac.c
> @@ -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
[1] https://lore.kernel.org/netdev/20220818161649.2058728-10-sean.anderson@seco.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: fman: memac: Uninitialized variable on error path
2022-08-25 14:32 ` Sean Anderson
@ 2022-08-25 14:36 ` Sean Anderson
0 siblings, 0 replies; 4+ messages in thread
From: Sean Anderson @ 2022-08-25 14:36 UTC (permalink / raw)
To: Dan Carpenter, Madalin Bucur
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Camelia Groza, netdev, kernel-janitors
On 8/25/22 10:32 AM, Sean Anderson wrote:
>
>
> On 8/25/22 9:17 AM, Dan Carpenter 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 <dan.carpenter@oracle.com>
>> ---
>> drivers/net/ethernet/freescale/fman/mac.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
>> index c376b9bf657d..f9a3f85760fb 100644
>> --- a/drivers/net/ethernet/freescale/fman/mac.c
>> +++ b/drivers/net/ethernet/freescale/fman/mac.c
>> @@ -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
>
> [1] https://lore.kernel.org/netdev/20220818161649.2058728-10-sean.anderson@seco.com/
>
Whoops, I didn't read this correctly.
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: fman: memac: Uninitialized variable on error path
2022-08-25 13:17 [PATCH net-next] net: fman: memac: Uninitialized variable on error path Dan Carpenter
2022-08-25 14:32 ` Sean Anderson
@ 2022-08-27 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-27 2:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: madalin.bucur, sean.anderson, davem, edumazet, kuba, pabeni,
camelia.groza, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
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 <dan.carpenter@oracle.com>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-27 2:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 13:17 [PATCH net-next] net: fman: memac: Uninitialized variable on error path Dan Carpenter
2022-08-25 14:32 ` Sean Anderson
2022-08-25 14:36 ` Sean Anderson
2022-08-27 2:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.