Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: cxgb: fix uninitialized variable in mi1_wait_until_ready()
@ 2026-12-04  6:15 mdshahid03
  2026-12-04  6:16 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: mdshahid03 @ 2026-12-04  6:15 UTC (permalink / raw)
  To: netdev; +Cc: andrew+netdev, davem, edumazet, kuba, pabeni, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@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 <mdshahid03@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  6:15 [PATCH] net: cxgb: fix uninitialized variable in mi1_wait_until_ready() mdshahid03
2026-12-04  6:16 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox