All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH] mac80211: use BUG_ON and return -EINVAL if rate_lowest_index() fails
Date: Wed, 15 Jun 2011 18:02:52 -0400	[thread overview]
Message-ID: <20110615220252.1918.73638.stgit@mj.roinet.com> (raw)

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

             reply	other threads:[~2011-06-15 22:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 22:02 Pavel Roskin [this message]
2011-06-16  9:08 ` [PATCH] mac80211: use BUG_ON and return -EINVAL if rate_lowest_index() fails 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110615220252.1918.73638.stgit@mj.roinet.com \
    --to=proski@gnu.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.