* [PATCH] wifi: mt76: Fix coverity issue for dma init
@ 2026-10-28 1:57 Eason Lai
0 siblings, 0 replies; only message in thread
From: Eason Lai @ 2026-10-28 1:57 UTC (permalink / raw)
To: nbd, lorenzo
Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, jeff.hsu,
eason.lai, Jeff Hsu
From: Jeff Hsu <Jeff.Hsu@mediatek.com>
Check the snprintf return value writing napi_dev->name
free both netdevs and return -EINVAL when < 0
Signed-off-by: Jeff Hsu <Jeff.Hsu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/dma.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index a67880a9281c..2c5d67a5bb81 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -1157,8 +1157,12 @@ mt76_dma_init(struct mt76_dev *dev,
priv = netdev_priv(dev->tx_napi_dev);
*priv = dev;
- snprintf(dev->napi_dev->name, sizeof(dev->napi_dev->name), "%s",
- wiphy_name(dev->hw->wiphy));
+ if (snprintf(dev->napi_dev->name, sizeof(dev->napi_dev->name), "%s",
+ wiphy_name(dev->hw->wiphy)) < 0) {
+ free_netdev(dev->tx_napi_dev);
+ free_netdev(dev->napi_dev);
+ return -EINVAL;
+ }
dev->napi_dev->threaded = 1;
init_completion(&dev->mmio.wed_reset);
init_completion(&dev->mmio.wed_reset_complete);
--
2.45.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-28 1:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 1:57 [PATCH] wifi: mt76: Fix coverity issue for dma init Eason Lai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox