From: Mohsin Bashir <mohsin.bashr@gmail.com>
To: mkubecek@suse.cz
Cc: netdev@vger.kernel.org, kuba@kernel.org, mohsin.bashr@gmail.com
Subject: [PATCH ethtool 1/3] ethtool: fbnic: fix off-by-one shift in reg dump parser
Date: Wed, 2 Sep 2026 16:07:37 -0700 [thread overview]
Message-ID: <20260902230739.2241212-2-mohsin.bashr@gmail.com> (raw)
In-Reply-To: <20260902230739.2241212-1-mohsin.bashr@gmail.com>
From: Mohsin Bashir <hmohsin@meta.com>
The INTR, INTR_CQ, QM_TX, QM_RX, TCE and TCE_RAM section parsers skipped
the first register value and stopped before the final register. Every
decoded value was consequently associated with the preceding CSR while
the section length still appeared valid.
Consume the first value without an extra increment and iterate through
the inclusive section end.
Fixes: a38a2d3a8271 ("ethtool: fbnic: ethtool dump parser")
Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
---
fbnic.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/fbnic.c b/fbnic.c
index a5b1d76..e368c60 100644
--- a/fbnic.c
+++ b/fbnic.c
@@ -5598,8 +5598,7 @@ static int fbnic_dump_fb_nic_intr_global(uint32_t **regs_buffp,
return -1;
}
- regs_buff++;
- for (csr_offset = csr_start_addr; csr_offset < csr_end_addr;
+ for (csr_offset = csr_start_addr; csr_offset <= csr_end_addr;
csr_offset += k) {
k = 1;
reg_val = *regs_buff;
@@ -5728,9 +5727,8 @@ static int fbnic_dump_fb_nic_intr_msix(uint32_t **regs_buffp,
* from a different register array at the same index.
* Every 4th register belongs to one register array
*/
- regs_buff++;
for (csr_offset = csr_start_addr;
- csr_offset < csr_end_addr; csr_offset++) {
+ csr_offset <= csr_end_addr; csr_offset++) {
i = csr_offset - *section_start;
reg_val = *regs_buff;
@@ -5818,9 +5816,8 @@ static int fbnic_dump_fb_nic_qm_tx_global(uint32_t **regs_buffp,
return -1;
}
- regs_buff++;
for (csr_offset = csr_start_addr;
- csr_offset < csr_end_addr; csr_offset++) {
+ csr_offset <= csr_end_addr; csr_offset++) {
reg_val = *regs_buff;
switch (csr_offset) {
case REGISTER_RANGE(FBNIC_QM_TWQ_IDLE):
@@ -6301,9 +6298,8 @@ static int fbnic_dump_fb_nic_qm_rx_global(uint32_t **regs_buffp,
return -1;
}
- regs_buff++;
for (csr_offset = csr_start_addr;
- csr_offset < csr_end_addr; csr_offset++) {
+ csr_offset <= csr_end_addr; csr_offset++) {
reg_val = *regs_buff;
switch (csr_offset) {
@@ -6750,9 +6746,8 @@ static int fbnic_dump_fb_nic_tce(uint32_t **regs_buffp,
return -1;
}
- regs_buff++;
for (csr_offset = csr_start_addr;
- csr_offset < csr_end_addr; csr_offset++) {
+ csr_offset <= csr_end_addr; csr_offset++) {
reg_val = *regs_buff;
switch (csr_offset) {
@@ -7450,9 +7445,8 @@ static int fbnic_dump_fb_nic_tce_ram(uint32_t **regs_buffp,
return -1;
}
- regs_buff++;
for (csr_offset = csr_start_addr;
- csr_offset < csr_end_addr; csr_offset++) {
+ csr_offset <= csr_end_addr; csr_offset++) {
reg_val = *regs_buff;
switch (csr_offset) {
--
2.53.0-Meta
next prev parent reply other threads:[~2026-09-02 23:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 23:07 [PATCH ethtool 0/3] ethtool: fbnic: Fix register dump parser Mohsin Bashir
2026-09-02 23:07 ` Mohsin Bashir [this message]
2026-09-02 23:07 ` [PATCH ethtool 2/3] ethtool: fbnic: Fix various TX and RX CSR fields decoding Mohsin Bashir
2026-09-02 23:07 ` [PATCH ethtool 3/3] ethtool: fbnic: Fix register dump names and bit labels Mohsin Bashir
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=20260902230739.2241212-2-mohsin.bashr@gmail.com \
--to=mohsin.bashr@gmail.com \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/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