Thread (1 message) 1 message, 1 author, 2022-11-28

Re: [PATCH v3 07/11] rtw88: Add common USB chip support

From: Kalle Valo <kvalo@kernel.org>
Date: 2022-11-28 13:41:48
Also in: linux-wireless, lkml

Sascha Hauer [off-list ref] writes:
quoted
quoted
+static void rtw_usb_write_port_tx_complete(struct urb *urb)
+{
+	struct rtw_usb_txcb *txcb = urb->context;
+	struct rtw_dev *rtwdev = txcb->rtwdev;
+	struct ieee80211_hw *hw = rtwdev->hw;
+
+	while (true) {
Is it possible to have a hard limit to prevent unexpected infinite loop?
Yes, that would be possible, but do you think it's necessary?
It's a common advice to have a limit for loops in kernel.
Each *txcb is used only once, It's allocated in rtw_usb_tx_agg_skb() and
&txcb->tx_ack_queue is filled with a limited number of skbs there. These
skbs is then iterated over in rtw_usb_write_port_tx_complete(), so I don't
see a way how we could end up in an infinite loop here.
Everyone always say that their code is bugfree ;) More seriously though,
even if it would be bugfree now someone else can add buggy code later.
So much better to have a limit for the loop.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help