linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: use BUG_ON and return -EINVAL if rate_lowest_index() fails
@ 2011-06-15 22:02 Pavel Roskin
  2011-06-16  9:08 ` Arend van Spriel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pavel Roskin @ 2011-06-15 22:02 UTC (permalink / raw)
  To: linux-wireless, John W. Linville

WARN_ON is not enough, as we cannot return a valid index, and the
callers will use whatever we return, causing a cascade of oopses and
eventually a panic.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e33fe79..d117019 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3108,10 +3108,10 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
 		if (rate_supported(sta, sband->band, i))
 			return i;
 
-	/* warn when we cannot find a rate. */
-	WARN_ON(1);
+	/* If we cannot find any rate, we are in trouble. */
+	BUG_ON(1);
 
-	return 0;
+	return -EINVAL;
 }
 
 static inline

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-06-19  8:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 22:02 [PATCH] mac80211: use BUG_ON and return -EINVAL if rate_lowest_index() fails Pavel Roskin
2011-06-16  9:08 ` Arend van Spriel
2011-06-16 22:06   ` Pavel Roskin
2011-06-16 10:22 ` Stanislaw Gruszka
2011-06-16 22:08   ` Pavel Roskin
2011-06-17  6:37     ` Arend van Spriel
2011-06-17 20:33       ` Pavel Roskin
2011-06-19  8:05 ` Johannes Berg

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).