* [PATCH v2] staging: rtl8712: fix wrong function output
@ 2021-04-09 12:46 Sergei Krainov
0 siblings, 0 replies; only message in thread
From: Sergei Krainov @ 2021-04-09 12:46 UTC (permalink / raw)
To: Larry.Finger, florian.c.schilhabel, gregkh
Cc: linux-staging, linux-kernel, kernel-janitors
Return NULL from r8712_find_network() if no matched wlan_network
was found. Code with a bug:
while (plist != phead) {
pnetwork = container_of(plist, struct wlan_network, list);
plist = plist->next;
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
break;
}
spin_unlock_irqrestore(&scanned_queue->lock, irqL);
return pnetwork;
In this code last processed pnetwork returned if list end was reached
and no pnetwork matched test condition.
Signed-off-by: Sergei Krainov <sergei.krainov.lkd@gmail.com>
---
Changes from v1: Updated description
drivers/staging/rtl8712/rtl871x_mlme.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 8a97307fbbd6..c38161114b80 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -146,6 +146,8 @@ static struct wlan_network *r8712_find_network(struct __queue *scanned_queue,
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
break;
}
+ if (plist == phead)
+ pnetwork = NULL;
spin_unlock_irqrestore(&scanned_queue->lock, irqL);
return pnetwork;
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-09 12:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09 12:46 [PATCH v2] staging: rtl8712: fix wrong function output Sergei Krainov
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).