net: fman: memac: Uninitialized variable on error path
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 25 Aug 2022 13:17:19 +0000 (16:17 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Aug 2022 02:47:36 +0000 (19:47 -0700)
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>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Link: https://lore.kernel.org/r/Ywd2X6gdKmTfYBxD@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fman/mac.c

index c376b9b..f9a3f85 100644 (file)
@@ -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;