netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Kimdon <david.kimdon@devicescape.com>
To: netdev@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>,
	Jiri Benc <jbenc@suse.cz>,
	David Kimdon <david.kimdon@devicescape.com>
Subject: [patch 3/3] d80211: silence sparse warning: bad constant expression
Date: Mon, 9 Oct 2006 10:03:45 -0700	[thread overview]
Message-ID: <20061009170345.GC27239@devicescape.com> (raw)
In-Reply-To: 20061009170159.804032000@devicescape.com

[-- Attachment #1: sparse.patch --]
[-- Type: text/plain, Size: 1081 bytes --]

Sparse does not figure out that algs[] isn't really a variable length array.
The message is:

net/d80211/ieee80211_sta.c:934:12: error: bad constant expression

This switches algs[] to be obviously a constant array, and derives the value of
num_algs algs[].  The code is correct and equivalent with or without this
change.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_sta.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_sta.c
+++ wireless-dev/net/d80211/ieee80211_sta.c
@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(struc
 		printk(KERN_DEBUG "%s: AP denied authentication (auth_alg=%d "
 		       "code=%d)\n", dev->name, ifsta->auth_alg, status_code);
 		if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
-			const int num_algs = 3;
-			u8 algs[num_algs];
+			u8 algs[3];
+			const int num_algs = sizeof(algs) / sizeof(algs[0]);
 			int i, pos;
 			algs[0] = algs[1] = algs[2] = 0xff;
 			if (ifsta->auth_algs & IEEE80211_AUTH_ALG_OPEN)

--

  parent reply	other threads:[~2006-10-09 17:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20061009170159.804032000@devicescape.com>
2006-10-09 17:02 ` [patch 1/3] d80211: use FCS_LEN instead of hardcoded number David Kimdon
2006-10-09 17:03 ` [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag David Kimdon
2006-10-10 10:00   ` Michael Buesch
2006-10-10 13:45     ` David Kimdon
2006-10-10 14:30       ` Michael Wu
2006-10-10 21:04       ` Michael Buesch
2006-10-11  0:37         ` David Kimdon
2006-10-09 17:03 ` David Kimdon [this message]
2006-10-09 20:11   ` [patch 3/3] d80211: silence sparse warning: bad constant expression David Kimdon
2006-10-18 13:56     ` Jiri Benc
2006-10-18 15:12       ` David Kimdon
2006-10-18 15:40         ` Jiri Benc

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=20061009170345.GC27239@devicescape.com \
    --to=david.kimdon@devicescape.com \
    --cc=jbenc@suse.cz \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /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 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).