From: Mohammad Shahid <mdsh…@gmail.com> Check the return value of _ti_tpi_read before using the value read from the MI1 register. When the TPI read fails, the output variable is not initialized. Using it to check the MI1 busy bit can result in an uninitialized value being accessed. Return immediately when the TPI read fails to avoid accessing the uninitialized variable. Fixes: 8199d3a79c22 ("[PATCH] A new 10GB Ethernet Driver by Chelsio Communications") Signed-off-by: Mohammad Shahid <mdsh…@gmail.com> --- drivers/net/ethernet/chelsio/cxgb/subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb/subr.c b/drivers/net/ethernet/chelsio/cxgb/subr.c index d4488e400bc6..bb42155d273a 100644 --- a/drivers/net/ethernet/chelsio/cxgb/subr.c +++ b/drivers/net/ethernet/chelsio/cxgb/subr.c @@ -255,7 +255,9 @@ static int mi1_wait_until_ready(adapter_t *adapter, int mi1_reg) do { u32 val; - __t1_tpi_read(adapter, mi1_reg, &val); + if (__t1_tpi_read(adapter, mi1_reg, &val)) + return 1; + busy = val & F_MI1_OP_BUSY; if (busy) udelay(10);
-- 2.43.0