Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

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>

authored by

Dan Carpenter and committed by
Jakub Kicinski
931d0a8b 7dea06db

+1 -1
+1 -1
drivers/net/ethernet/freescale/fman/mac.c
··· 389 389 { 390 390 int err; 391 391 struct fman_mac_params params; 392 - struct fixed_phy_status *fixed_link; 392 + struct fixed_phy_status *fixed_link = NULL; 393 393 394 394 mac_dev->set_promisc = memac_set_promiscuous; 395 395 mac_dev->change_addr = memac_modify_mac_address;