pds_core: fix irq index bug and compiler warnings
Subsystems (3)
v2 cover pds_core: fix irq index bug and compiler warnings
The first patch fixes a bug in our interrupt masking where we used the wrong index. The second patch addresses a couple of kernel test robot string truncation warnings.
v2: added Fixes tags to commit messages and more detail to first commit msg
Shannon Nelson (2):
pds_core: use correct index to mask irq
pds_core: fix up some format-truncation complaints
drivers/net/ethernet/amd/pds_core/adminq.c | 2 +- drivers/net/ethernet/amd/pds_core/core.h | 2 +- drivers/net/ethernet/amd/pds_core/dev.c | 8 ++++++-- drivers/net/ethernet/amd/pds_core/devlink.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/2 pds_core: use correct index to mask irq
Use the qcq's interrupt index, not the irq number, to mask the interrupt. Since the irq number can be out of range from the number of possible interrupts, we can end up accessing and potentially scribbling on out-of-range and/or unmapped memory, making the kernel angry.
[ 3116.039364] BUG: unable to handle page fault for address: ffffbeea1c3edf84
[ 3116.047059] #PF: supervisor write access in kernel mode
[ 3116.052895] #PF: error_code(0x0002) - not-present page
[ 3116.058636] PGD 100000067 P4D 100000067 PUD 1001f2067 PMD 10f82e067 PTE 0
[ 3116.066221] Oops: 0002 [#1] SMP NOPTI
[ 3116.092948] RIP: 0010:iowrite32+0x9/0x76
[ 3116.190452] Call Trace:
[ 3116.193185] <IRQ>
[ 3116.195430] ? show_trace_log_lvl+0x1d6/0x2f9
[ 3116.200298] ? show_trace_log_lvl+0x1d6/0x2f9
[ 3116.205166] ? pdsc_adminq_isr+0x43/0x55 [pds_core]
[ 3116.210618] ? __die_body.cold+0x8/0xa
[ 3116.214806] ? page_fault_oops+0x16d/0x1ac
[ 3116.219382] ? exc_page_fault+0xbe/0x13b
[ 3116.223764] ? asm_exc_page_fault+0x22/0x27
[ 3116.228440] ? iowrite32+0x9/0x76
[ 3116.232143] pdsc_adminq_isr+0x43/0x55 [pds_core]
[ 3116.237627] __handle_irq_event_percpu+0x3a/0x184
[ 3116.243088] handle_irq_event+0x57/0xb0
[ 3116.247575] handle_edge_irq+0x87/0x225
[ 3116.252062] __common_interrupt+0x3e/0xbc
[ 3116.256740] common_interrupt+0x7b/0x98
[ 3116.261216] </IRQ>
[ 3116.263745] <TASK>
[ 3116.266268] asm_common_interrupt+0x22/0x27--- drivers/net/ethernet/amd/pds_core/adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/pds_core/adminq.c +1 -1
@@ -146,7 +146,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) }queue_work (pdsc->wq, &qcq->work); -pds_core_intr_mask (&pdsc->intr_ctrl[irq],PDS_CORE_INTR_MASK_CLEAR ); +pds_core_intr_mask (&pdsc->intr_ctrl[qcq->intx],PDS_CORE_INTR_MASK_CLEAR );return IRQ_HANDLED ; }
Signature · 1 line
2.17.1
PATCH v2 2/2 pds_core: fix up some format-truncation complaints
In reply to Shannon NelsonOur friendly kernel test robot pointed out a couple of potential string truncation issues. None of which were we worried about, but can be relatively easily fixed to quiet the complaints.
--- drivers/net/ethernet/amd/pds_core/core.h | 2 +- drivers/net/ethernet/amd/pds_core/dev.c | 8 ++++++-- drivers/net/ethernet/amd/pds_core/devlink.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/amd/pds_core/core.h +1 -1
@@ -15,7 +15,7 @@#define PDSC_DRV_DESCRIPTION "AMD/Pensando Core Driver"#define PDSC_WATCHDOG_SECS 5 -#define PDSC_QUEUE_NAME_MAX_SZ 32 +#define PDSC_QUEUE_NAME_MAX_SZ 16#define PDSC_ADMINQ_MIN_LENGTH 16/* must be a power of two */ #define PDSC_NOTIFYQ_LENGTH 64/* must be a power of two */ #define PDSC_TEARDOWN_RECOVERY false
drivers/net/ethernet/amd/pds_core/dev.c +6 -2
@@ -261,10 +261,14 @@ static int pdsc_identify(struct pdsc *pdsc)struct pds_core_drv_identity drv = {};size_t sz;int err; +int n; drv.drv_type =cpu_to_le32 (PDS_DRIVER_LINUX ); -snprintf (drv.driver_ver_str,sizeof (drv.driver_ver_str), -"%s %s" ,PDS_CORE_DRV_NAME ,utsname ()->release); +/* Catching the return quiets a Wformat-truncation complaint */ + n =snprintf (drv.driver_ver_str,sizeof (drv.driver_ver_str), +"%s %s" ,PDS_CORE_DRV_NAME ,utsname ()->release); +if (n >sizeof (drv.driver_ver_str)) +dev_dbg (pdsc->dev,"release name truncated, don't care\n" );/* Next let's get some info about the device * We use the devcmd_lock at this level in order to
drivers/net/ethernet/amd/pds_core/devlink.c +1 -1
@@ -104,7 +104,7 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req,struct pds_core_fw_list_info fw_list;struct pdsc *pdsc =devlink_priv (dl);union pds_core_dev_comp comp; -char buf[16 ]; +char buf[32 ];int listlen;int err;int i;
Signature · 1 line
2.17.1
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Mon, 13 Nov 2023 10:32:55 -0800 you wrote:
The first patch fixes a bug in our interrupt masking where we used the wrong index. The second patch addresses a couple of kernel test robot string truncation warnings.
v2: added Fixes tags to commit messages and more detail to first commit msg
Shannon Nelson (2):
pds_core: use correct index to mask irq
pds_core: fix up some format-truncation complaints[...]
Here is the summary with links:
- [net,v2,1/2] pds_core: use correct index to mask irq
https://git.kernel.org/netdev/net/c/09d4c14c6c5e - [net,v2,2/2] pds_core: fix up some format-truncation complaints https://git.kernel.org/netdev/net/c/7c02f6ae676a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html