* [PATCH 09/21] net/ena: add verification of DMA address width
@ 2025-10-15 7:10 Shai Brandes
0 siblings, 0 replies; only message in thread
From: Shai Brandes @ 2025-10-15 7:10 UTC (permalink / raw)
To: stephen; +Cc: dev, Shai Brandes, Amit Bernstein
Fixed improper handling of error conditions when retrieving the
physical DMA address width from the device.
Currently, in case ena_com_get_dma_width() timeouts or retrieves invalid
value, it will go unnoticed and the flow will continue as usual using
error value as the dma width address.
Signed-off-by: Amit Bernstein <amitbern@amazon.com>
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Yosef Raisman <yraisman@amazon.com>
---
drivers/net/ena/ena_ethdev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 568aca1152..5147a754b2 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1948,7 +1948,7 @@ static int ena_device_init(struct ena_adapter *adapter,
{
struct ena_com_dev *ena_dev = &adapter->ena_dev;
uint32_t aenq_groups;
- int rc;
+ int dma_width, rc;
bool readless_supported;
/* Initialize mmio registers */
@@ -1978,7 +1978,12 @@ static int ena_device_init(struct ena_adapter *adapter,
goto err_mmio_read_less;
}
- ena_dev->dma_addr_bits = ena_com_get_dma_width(ena_dev);
+ dma_width = ena_com_get_dma_width(ena_dev);
+ if (unlikely(dma_width < 0)) {
+ PMD_DRV_LOG_LINE(ERR, "Invalid dma width value %d", dma_width);
+ rc = dma_width;
+ goto err_mmio_read_less;
+ }
/* ENA device administration layer init */
rc = ena_com_admin_init(ena_dev, &aenq_handlers);
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-15 7:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 7:10 [PATCH 09/21] net/ena: add verification of DMA address width Shai Brandes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).