Netdev List
 help / color / mirror / Atom feed
From: mdshahid03@gmail.com
To: netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com,
	Mohammad Shahid <mdshahid03@gmail.com>
Subject: [PATCH] net: cxgb: fix uninitialized variable in mi1_wait_until_ready()
Date: Fri,  4 Dec 2026 11:45:48 +0530	[thread overview]
Message-ID: <20261204061548.59242-1-mdshahid03@gmail.com> (raw)

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


             reply	other threads:[~2026-12-04  6:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  6:15 mdshahid03 [this message]
2026-12-04  6:16 ` [PATCH] net: cxgb: fix uninitialized variable in mi1_wait_until_ready() netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204061548.59242-1-mdshahid03@gmail.com \
    --to=mdshahid03@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox