From: Kyungwook Boo <bookyungwook@gmail.com>
To: Manish Chopra <manishc@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Divide-by-zero error in qed_hw_get_nvm_info()
Date: Mon, 3 Mar 2025 15:40:56 +0900 [thread overview]
Message-ID: <3e620e1e-d3e2-4243-a355-0874bd25775d@gmail.com> (raw)
Hello,
It seems that qed_hw_info_port_num() reads the value of num_ports from MMIO
and then qed_hw_get_nvm_info() performs a division opertation
using this value, which could lead to a divide-by-zero error.
The following is a call stack example:
qed_probe
├── qed_hw_prepare
│ ├── qed_hw_prepare_single
│ │ ├── qed_get_hw_info
│ │ │ ├── qed_hw_info_port_num
│ │ │ │ ├── qed_rd (MMIO read: num_ports)
│ │ │ ├── qed_hw_get_nvm_info
│ │ │ │ ├── MFW_PORT (uses num_ports in modulo)
In qed_hw_info_port_num(), cdev->num_ports is read from MMIO:
cdev->num_ports = (u8)qed_rd(p_hwfn, p_ptt, addr);
This value is then used for modulo operation in qed_hw_get_nvm_info():
port_cfg_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
offsetof(struct nvm_cfg1, port[MFW_PORT(p_hwfn)]);
// #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
// qed_device_num_ports((_p_hwfn)->cdev))
Could you check this?
Best regards,
Kyungwook Boo
reply other threads:[~2025-03-03 6:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3e620e1e-d3e2-4243-a355-0874bd25775d@gmail.com \
--to=bookyungwook@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manishc@marvell.com \
--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
all inboxes | Powered by JetHome®