From patchwork Wed Jun 15 22:02:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Roskin X-Patchwork-Id: 883682 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5FM2tBI024969 for ; Wed, 15 Jun 2011 22:02:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752908Ab1FOWCy (ORCPT ); Wed, 15 Jun 2011 18:02:54 -0400 Received: from c60.cesmail.net ([216.154.195.49]:27611 "EHLO c60.cesmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323Ab1FOWCx (ORCPT ); Wed, 15 Jun 2011 18:02:53 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 15 Jun 2011 18:02:53 -0400 Received: from mj.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id 3620A34C8A; Wed, 15 Jun 2011 18:04:39 -0400 (EDT) Subject: [PATCH] mac80211: use BUG_ON and return -EINVAL if rate_lowest_index() fails To: linux-wireless@vger.kernel.org, "John W. Linville" From: Pavel Roskin Date: Wed, 15 Jun 2011 18:02:52 -0400 Message-ID: <20110615220252.1918.73638.stgit@mj.roinet.com> User-Agent: StGit/0.15-111-g507b MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 15 Jun 2011 22:02:56 +0000 (UTC) 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 --- 0 files changed, 0 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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