linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: nick black <dankamongmen@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] don't use unsigned ints for signed data, print_mcs_index()
Date: Wed, 7 Dec 2011 00:55:26 -0500	[thread overview]
Message-ID: <20111207055526.GA13903@qemfd.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

Johannes et al,

Trivial patch. Don't use unsigned ints for clearly signed data. Though the
code as stands works, it's brittle in the face of change, and generates
compiler warnings. Please apply. Taken against Debian's iw-3.1. Thanks!

diff -ur iw-3.1-orig/util.c iw-3.1/util.c
--- iw-3.1-orig/util.c	2011-12-07 00:43:05.495669921 -0500
+++ iw-3.1/util.c	2011-12-07 00:51:45.558545571 -0500
@@ -384,7 +384,7 @@
 
 static void print_mcs_index(const __u8 *mcs)
 {
-	unsigned int mcs_bit, prev_bit = -2, prev_cont = 0;
+	int mcs_bit, prev_bit = -2, prev_cont = 0;
 
 	for (mcs_bit = 0; mcs_bit <= 76; mcs_bit++) {
 		unsigned int mcs_octet = mcs_bit/8;
@@ -458,7 +458,7 @@
 	if (max_ampdu_length) {
 		printf("\t\tMaximum RX AMPDU length %d bytes (exponent: 0x0%02x)\n",
 		       max_ampdu_length, exponent);
-        } else {
+	} else {
 		printf("\t\tMaximum RX AMPDU length: unrecognized bytes "
 		       "(exponent: %d)\n", exponent);
 	}
@@ -466,8 +466,8 @@
 
 void print_ampdu_spacing(__u8 spacing)
 {
-        printf("\t\tMinimum RX AMPDU time spacing: %s (0x%02x)\n",
-               print_ampdu_space(spacing), spacing);
+	printf("\t\tMinimum RX AMPDU time spacing: %s (0x%02x)\n",
+	       print_ampdu_space(spacing), spacing);
 }
 
 void print_ht_capability(__u16 cap)

-- 
                                       nick black <nickblack@linux.com>
"A main cause of the Roman Empire's fall was that–lacking zero–they had
       no way to indicate successful termination of their C programs."

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2011-12-07  5:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07  5:55 nick black [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-12-07  6:01 [[PATCH] don't use unsigned ints for signed data, print_mcs_index()] nick black

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=20111207055526.GA13903@qemfd.net \
    --to=dankamongmen@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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).